1.1
Public class Test { publicstaticvoid main (string[] args) { System.out.println ( "Welcome to Java"); System.out.println ("Welcome to Computer"); SYSTEM.OUT.PRINTLN ("Programming is Fun");} }
1.2
Public class Test { publicstaticvoid main (string[] args) { for ( int i = 0; I < 5; i++) { System.out.println ("Welcome to Java"); }}}
1.3
Public class Test { publicstaticvoid main (string[] args) { System.out.println ( " J a v v a"); System.out.println (" J a a v v a"); System.out.println ("J J AAAAA v v AAAAA"); System.out.println ("JJ a a V a "); }}
1.4
Public class Test { publicstaticvoid main (string[] args) { System.out.println ( "A a^2 a^3"); System.out.println ("1 1 1"); System.out.println ("2 4 8"); System.out.println ("3 9 "); System.out.println ("4 ");} }
1.5
Public class Test { publicstaticvoid main (string[] args) { double s = (9.5*4.5-2.5*3)/(45.5-3.5); System.out.println (s); // 0.8392857142857143 }}
1.6
Public class Test { publicstaticvoid main (string[] args) { int s=0 ; for (int i=0; i<10; + +i) { s+ =i; } System.out.println (s); // $ }}
1.7
Public classTest { Public Static voidMain (string[] args) {DoublePI = 0; DoubleT; intM=1; for(intI=1; i<12121358; i++) {T=1.0/(2*i-1); T*=m; Pi+=T; M*=-1; } Pi*=4; System.out.println (PI); //3.1415927360890374 }}
Programming exercises in the 1th chapter of Java language programming