PERCOBAAN 1 : public class TestGreeting{ Greeting hello = new Greeting(); hello.greet(); class Greeting { public void greet(){ System.out.println("hi"); PERCOBAAN 2 : Nama file : Test1.java public class Test1{ public class TestAnother1{ PEMBETULAN Test1.java Ahmad Reza Musthafa 1
public class Test1{ TestAnother1 tes=new TestAnother1(); tes.main(); class TestAnother1{ public static void main(){ PERCOBAAN 3 Nama file : Test2.java public class Testing2{ PEMBETULAN Test2.java public class Test2{ Ahmad Reza Musthafa 2
PERCOBAAN 4 Nama file : Test3.java public class Test3{ public static void main(string args){ PEMBETULAN Test3.java public class Test3{ PERCOBAAN 5 : Nama file : Test4.java public class Test4{ public void main(string[] args){ Ahmad Reza Musthafa 3
PEMBETULAN Test4.java public class Test4{ PERCOBAAN 6 : Nama file : Test5.java public class Test5 { int[] x = new int[ 10 ]; public Test5() { for (int i = 0; i<= 10; i++){ x[i] = i; System.out.println("Isi x ke : " + i + " = " + x[i]); Test5 test = new Test5(); Ahmad Reza Musthafa 4
public class Test5 { int[] x = new int[ 11 ]; PEMBETULAN Test5.java public Test5() { for (int i = 0; i<= 10; i++){ x[i] = i; System.out.println("Isi x ke : " + i + " = " + x[i]); Test5 test = new Test5(); PERCOBAAN 7 Nama file : Test6.java public class Test6 { int[] x = new int[ 10 ]; int val = 20; Ahmad Reza Musthafa 5
public Test6() { for (int i = 0; i< 10; i++){ x[i] = i; float res = val / x[i]; System.out.println("result " + " = " + res); Test6 test = new Test6(); public class Test6 { int[] x = new int[ 11 ]; float val = 20; PEMBETULAN Test6.java public Test6() { for (int i = 0; i< 10; i++){ x[i] = i; float res = val / x[i]; System.out.println("result " + " = " + res); Test6 test = new Test6(); Ahmad Reza Musthafa 6
PERCOBAAN 8 Nama file : Test7.java public Test7 { System.out.println("Hallo.."); PEMBETULAN Test7.java public class Test7 { System.out.println("Hallo.."); PERCOBAAN 9 Nama file : Test8.java Ahmad Reza Musthafa 7
public class Test8 { String name = "Reza"; public void getname(){ return name; Test8 test = new Test8(); System.out.println("Nama saya : " + test.getname()); public class Test8 { private String name = "Reza"; PEMBETULAN Test8.java public String getname(){ return name; Test8 test = new Test8(); System.out.println("Nama saya : " + test.getname()); PERCOBAAN 10 Nama file : Test9.java public class Test9 { String text = "abaaba"; Ahmad Reza Musthafa 8
public void addtext(){ if (text.length() >= 6) { text += text; else { text += text.substring(3); System.out.println("New Text : " + text); Test9 test = new Test9(); test.addtext(); public class Test9 { String text = "abaaba"; PEMBETULAN Test9.java public void addtext(){ if (text.length() >= 6) { text += text; else { text += text.substring(3); System.out.println("New Text : " + text); Test9 test = new Test9(); test.addtext(); Ahmad Reza Musthafa 9
PERCOBAAN 11 Nama file : Test10.java public class Test10 { boolean newacct = true; double deposit = 17.29; public void check(){ if (newacct == true) { double balance = 100.0; if (deposit > 0) { balance += deposit; System.out.println("Balance = " + balance); Test10 test = new Test10(); test.check(); public class Test10 { boolean newacct = true; double deposit = 17.29; double balance; PEMBETULAN Test10.java public void check(){ if (newacct == true) Ahmad Reza Musthafa 10
{ double balance = 100.0; if (deposit > 0) { balance =+ deposit; System.out.println("Balance = " + balance); Test10 test = new Test10(); test.check(); Ahmad Reza Musthafa 11