Advertisements

Aatul Palandurkar

Posts Tagged ‘Java 2 Standard Edition

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 :

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.
Advertisements

 

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

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

 

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.

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


Advertisements

Enter your email address to subscribe to this blog and receive notifications of new posts by email.

Join 8,910 other followers

Tweets

YouTube

%d bloggers like this: