Java

New Website of Java User Group, Nagpur

Hey friends,

We have a great news! Java User Group, Nagpur launched their new website (http://jugnagpur.com/).

The old website was erased due to the heavy inflow of spam accounts which went over half a million, and become completely uncontrollable to handle all the activities & launched new website.

Now new website is open for the membership but all membership requests will be moderated by the experts panel of moderators. Those who are really interested in being a part of Java User Group, Nagpur (INDIA) & those who were authentic members of JUG Nagpur will have to request for the membership again. Whereas if you are not interested in joining JUG Nagpur & simply want to post comments on topics, one doesn’t need to get registered, anyone can post comments on topics.

I have also registered for the same & eagerly waiting to be a part of moderator team & would really love to so that we can spread the proper knowledge & contents related to Java & Technologies to the world. This will also help to restrict malicious activities on website too.

If you want to know more about JUG, Nagpur : Read here…..

Java User Group, Nagpur (INDIA)

What is Java User Group, Nagpur

 Java User Group Nagpur is a forum for collaboration and creative interaction for all interested in Java and new technologies revolving around Java.

 

JUG Nagpur
Abbreviation for Java User Group and Nagpur is the name of city where this group is located. This group provides opportunities for group meetings, one to one expert sessions and presentations.

 

Project Page
http://java.net/projects/jugnagpur/
Project page is a link to the Java.net web site. This is the entry through which we will be listing our group in Java User Groups Community.

 

Mailing List
http://groups.google.com/group/jugnagpur
The mailing list is the most important collaboration tool we use. All the transactions and knowledge sharing happens through this mailing list.

 

Wiki
http://jugnagpur.wikispaces.com/
Group wiki make the space available to all the group members to contribute creatively. The content getting matured on the wiki will be selectively shifted to the web site.

 

Group Blog
http://jugnagpur.blogspot.com
Blog where all group members can write their experiences and news about the JUG events.

How to set Path for Java

Dear Friends,

If you want to set the path for Java, there are two main types for setting system path for Java which are as follows;

  1. Temporary Path
  2. Permanent Path

For the above two types, the video describes the complete step by step procedure for setting path for Java :

[youtube=http://www.youtube.com/watch?v=rM4Qq3Ua7Sk]

Or you can go through this tutorial :

1. To check path is set or not :
a. Go to Start Menu
b. Go to Run
c. Type “cmd” without quotes to open Command prompt.
d. Get to the root directory say c:/>
e. To check whether the path is already set or not, on command prompt type “javac” without quotes & press enter/return. If the following message appears on the console screen then the path is not set.

f. But if the other message having length nearly equal to half a page then path is set.

2. Temporary Path :

To set the temporary path follow the steps given below;
a. Open Command Prompt.
b. If path is not set &  want to set it temporarily, assume the Java 1.6.0 is installed on your system, type following command on console screen :
And finally the path is set temporarily.
Note : This will work only for the current window, won’t work if you open another window.

3. Permanent Path :

To set the path permanently follow the steps given below;
a. Right Click on “My Computer Icon”.
b. Go to “Properties”.
c. Go to “Advanced” tab.
d. Click on “Environment Variables”.
e. Go to “System Variables”.
f. Find “Path” variable, select it & click “Edit”.
g. Small window will appear. Go to end by simply pressing “End” button & type following path with semicolon ( ; ) as prefix but without quotes;
    “;C:\Program Files\Java\jdk1.6.0\bin
h. Press “OK”, again “OK”, again “OK”.
And finally the path is set permanently.
i. To check whether the path is set or not simply refer details given above in the section 1.

Java 7 Launch Celebration – JUG Nagpur

[slideshow]

Venue :

Persistent Systems Limited,

Cafeteria,

3rd Floor,

Infotech Tower,

IT Park,

MIDC Parsodi,

Nagpur – 440 022, India

Date & Time : Sunday 10th July 2011,  2 PM to 4 PM

Java 7 Launch celebration event held at above mentioned venue, date & time too. The complete event was organized by JUG Nagpur in association with Oracle. The venue was sponsored by Persistent Systems Limited.

In the opening, Mr. Abhiram Gandhe put quiz based on Java; which was a good experience & helped beginners to learn some lessons of Java. Then Tushar Joshi Sir presented presentation on new features of Java 7 & 8, and put light on other stuff related to Java which was followed by the presentation on Java User Group (JUG), Nagpur, its objectives, activities, etc. After the event there was arrangement of snacks, tea/coffee & cookies too.

The whole event was so awesome, full of energy & enthusiasm. I enjoyed a lot today & had a great day today. Thanks a lot for Oracle for free Java 7 T-shirts & all support for everything else.

Hope such events will be held in future too since these events are very helpful for professionals, students, etc.; also hope there will be great increase in Java users in Nagpur & all over the world. The most important thing is that many others would have noted that there is great future in Java & technologies. I just Love Java 7 ! 🙂

Java 7 Launch

Hey folks,

I am very glad to inform you that finally Oracle has planned to launch the most awaiting Java 7 on Thursday 7th July 2011. Oracle has also planned several celebration events / parties & in preparation of these events they have created a Technical Launch Kit which includes Java 7 presentations, code samples, and T-shirts, etc.

We at JUG (Java User Group), Nagpur have also planned the celebration event / party on Sunday 10th July 2011.

 

Venue :

Persistent Systems Limited,

Cafeteria,

3rd Floor,

Infotech Tower,

IT Park,

MIDC Parsodi,

Nagpur – 440 022, India

 

Date & Time : Sunday 10th July 2011,  2 PM to 4 PM

 

Registration : http://www.jugnagpur.com/  (Official website of JUG Nagpur)

 

Prerequisite :

 

Who can join us :

  • Developer/Designer
  • Manager/Director/CEO
  • Students
  • Anyone who is interested in Java & technologies.

 

Technical Launch Kit :

Once you are registered with the JUG Nagpur & for the event, you can download the Java 7 kit here; http://download.oracle.com/technetwork/java/java7-kit.zip

Writing Comments in Java

Objective :

  • How to write comments in Java?
  • How to write single line comment in Java?
  • How to write multi line comment in Java?
  • How to write documentation comment in Java?
  • What are the types of comments in Java?

Writing Comments in Java :

  • Comments are the statements which are never executed (i.e. non-executable statements).
  • Comments are often used to add notes between source code so that it becomes easy to understand & explain the function or operation of the corresponding part of source code.
  • Java Compiler doesn’t read comments; comments are simply ignored during compilation.
  • There are 3 types of comments available in Java as follows;
  1. Single Line Comment
  2. Multi Line Comment
  3. Documentation Comment

Single Line Comment :

This comment is used whenever we need to write anything in single line.

Syntax : 

//<write comment here>

Example :

[sourcecode language=”java”]
//This is Single Line Comment.
[/sourcecode]

Multi Line Comment :

This type of comments are used whenever we want to write detailed notes (i.e. more than one line or in multiple lines)related to source code.

Syntax :

/*

<write comment here>

*/

Example :  

[sourcecode language=”java”]
/*
This
Is
The
Multi
Line
Comment
*/
[/sourcecode]

Documentation Comment :

  • The documentation comment is used commonly to produce the javadoc for the respective program.
  • The javadoc is generally HTML, if used in project it is a set of multiple HTML files describing each java program in the corresponding project.
  • In the documentation comment we can add different notations such as author of the project or program, version, parameters required, information on results in return if any, etc.
  • To add these notations, we have ‘@’ operator.  We just need to write the required notation along with the ‘@’ operator.
  • Some javadoc tags are;
    1. @author – To describe the author of the project.
    2. @version – To describe the version of the project.
    3. @param – To explain the parameters required to perform respective operation.
    4. @return – To explain the return type of the project.

Syntax :

/**

*<write comment/description here>

*@author <write author name>

*@version <write version here>

*@param <write parameter here>

*@return <write return type here>

*/

Example :  

[sourcecode language=”java”]
/**
* This is Documentation Comment.
* @author Atul Palandurkar
* @version 1.0.0
*/
[/sourcecode]

Escape Sequences in Java

 

Objectives :

  • What are the escape sequences in Java?
  • What are the escape characters in Java?

 

Generally we enter all the characters directly. The escape sequences are used for those characters which cannot be entered directly.

Sequence Purpose
\n New Line (i.e. Line feed)
\b Backspace
\t Tab
\r Carriage return
\f Form Feed
\\ Backslash
\’ Single quote
\” Double quote
\ddd Octal Characters (i.e. ddd)
\uxxxx Hexadecimal Unicode Characters (i.e. xxxx)

Escape Sequences in Java

Separators in Java

Following are the some characters which are generally used as the separators in Java.

Separator

Name

Use

.

Period

It is used to separate the package name from sub-package name & class name. It is also used to separate variable or method from its object or instance.

,

Comma

It is used to separate the consecutive parameters in the method definition. It is also used to separate the consecutive variables of same type while declaration.

;

Semicolon

It is used to terminate the statement in Java.

()

Parenthesis

This holds the list of parameters in method definition. Also used in control statements & type casting.

{}

Braces

This is used to define the block/scope of code, class, methods.

[]

Brackets

It is used in array declaration.

Separators in Java

 

Operators in Java

In Java we are provided with number of different operators & these operators are further divided into arithmetic, bitwise, relational and logical groups.

Arithmetic Operators

The arithmetic operators are used to perform the arithmetic operations in algebra.

Operator Operation
+ Addition
Subtraction
* Multiplication
/ Division
% Modulus
++ Increment
+= Addition assignment
-= Subtraction assignment
*= Multiplication assignment
/= Division assignment
%= Modulus assignment
Decrement

Arithmetic Operators in Java

Bitwise Operators

The bitwise operators are used to perform the different operations depending upon the individual operators.

Operator Operation
~ Bitwise Unary NOT
& Bitwise AND
| Bitwise OR
^ Bitwise Exclusive OR
>>  Shift Right with Sign Fill
>>>  Shift Right with Zero Fill
<<  Shift Left
&= Bitwise AND assignment
|= Bitwise OR assignment
^= Bitwise Exclusive OR assignment
>>= Shift Right assignment
>>>= Shift Right Zero Fill assignment
<<= Shift Left assignment

Bitwise Operators in Java

Relational Operators

The relational operators are used relate or to determine the relationship between the two operands.

Operator

Operation
== Equal to
!= Not equal to
Greater than
Less than
>= Greater than equal to
<= Less than equal to

Relational Operators in Java


Boolean Logical Operators

The boolean logical operators are used combine the two boolean operands resulting in new boolean value.

Operator Operation
& Logical AND
| Logical OR
^ Logical Exclusive OR
&& Short-circuit AND
|| Short-circuit OR
! Logical Unary NOT
&= AND assignment
|= OR assignment
^= Exclusive OR assignment
== Equal to
!= Not equal to
?: Ternary If-Then-Else

Boolean Logical Operators in Java

 

 The ? Operator

This is the special ternary operator in Java which is used to replace certain types of if-then-else statements.

Syntax :-

expression1 ? expression2 : expression3

 If expression1 results boolean value true then, expression2 is executed otherwise expression3 is executed.

Keywords in Java

In Java there are total 49 keywords are available.

The keywords “const” & “goto” are reserved & not used.

The “true”, “false” & “null” are values.

One cannot use the keywords for any other purpose.

Following are the keywords in Java:

abstract assert boolean break byte
case catch char class const
continue default do double else
extends final finally float for
goto if implements import instanceof
int interface long native new
package private protected public return
short static strictfp super switch
synchronized this throw throws transient
try void volatile while ——

Keywords in Java