aint= 10 afloat=7.7777776E7 adouble=7.7777776E7 aboolean=false
class P006_ForwardReference{ public static void main(String args[]) { A a=new A(); System.out.println(a.x); // 100 }}class A{ //int m=n; illegal forward reference int n=30; int x=getVal(); int getVal() { return 100; }}
class P005_Scope{ public static void main(String args[]) { { int i=100; } // line below gives the error: can not resolve symbol i System.out.println(i); }}
b=-128, s=-32768, i=2147483647, l=9223372036854775806,
f=3.4E38, d=1.7E308
The following statements will give error at compile time:
class P003_Addition{ public static void main(String args[]) { int No1,No2,Sum; No1=10; No2=20; Sum=No1+No2; System.out.println("Sum=" + Sum); }}
Output:
sum=30
class P002_EscapeSequence{ public static void main(String args[]) { System.out.println("One\nTwo\rThree\tFour\bFive\fSix"); }}
OneTwoThree FourFiveSix
Lesson#1
Like most other programming language tutorials I will start with writing a Java program that prints “Hello World” on the screen. Here it is:
class P001_HelloWorld{ public static void main(String args[]) {…