Professional Documents
Culture Documents
Java Week 1
Java Week 1
Java Week 1
-1 ) (Digits 9, ......... 4 , 3 ,2 ,1 ,0
z ..a -2 ((Letters Z .. A
3- ) ( Special Symbol ) ( ) ) ( : )) ( $
.
) -:
)1 The Character Type
) )
) ( 16 -32767 .32767
A $ c 3
)The String Type 2
) ) )
( ) .
4 + 3 equal 7 3 + 2 =5 This is java program
(3 The Integer Type
) ( - .
0 2 567 -1001
-:
long compiler ) 64
int 32
short ) 16
byte 8
) (true ) (false 8
x = 3 y = 5 -:
( ) true X< y
)(identifiers
:- )
1- ) (_) (under score).
-2 ) )
)_( ) .
-3 ) _ (.
-4 )
( VALUE value.
5- .
Reserved Words
) (class
) (method ) (compiler -:
abstract const final this for float interface throw true if else char
Comments
) )
) (//
) (*/ )* (/ .
Integer variables
).(int
; String str = Hi This is Frist Program
)
. )
class identifier_name
{
;Variable_Declarations
;statement_1
;statement_2
;statement_3
. Program Body
.
;statement_n
}
class identifier_name
Variable_Declarations
Statement ) );
// This is the first program in java
class Example_one
{
)(// This program starts with a call to main
)public static void main(String [] args
{
// Output Statement
;)System.out.println( Hello ! Welcome to the First JAVA program
}
}
Print Statement
) (print -:
) ;System.out.print(Expr1 + Expr2+
System ( )Package
Expr1+ Expr2
. ) (+
:-
;)System.out.print( ansr + 20 + 30
) (+ ansr
20 30 -:
ansr 2030
:
;))System.out.print( ansr + (20 + 30
:- )
ansr50
:
;)System.out.print(The product of + 8 + * + 3
;)System.out.print(equal to + 24
The product of 8 *3 equal to 24
Escape Characters
)
)\( ) ( :
\ddd )(ddd
\uxxxx )(xxxx
\n
\t 7
\b
\f
\\ \
\
\
Read Statement
) (read )(readLine
.
-:
;)( var = type.valueOf(inData.readLine().trim()).typeValue
var : .
. type
)( ()String valueOf
) (Intrger ).(Float
( .)Buffer trim
) (InputStream
;*.import java.io
));BufferedReader inData=new BufferedReader(new InputStreamReader(System.in
.*; import java.io
class read_int_float
}
public static void main(String[]args) throws IOException
}
; BufferedReader inData=new BufferedReader(new InputStreamReader(System.in))
;int k
;char ch; float x
;System.out.print( Enter your Integer Number)
k=Integer.valueOf(inData.readLine().trim()).intValue();
;System.out.print( Enter your Float Number)
x=Float.valueOf(inData.readLine().trim()).floatValue();
System.out.print( Enter your Character );
ch= (char) inData.read();
System.out.print( Your Integer Number + k);
System.out.print( Your Float Number + x);
System.out.print( Your Character + ch);
}
}