Our Blog

Latihan Java


Latihan Java 1 with (For)
Import java.util.Scanner;
Public class newclass
                Public static void main(String[]arg){
Scanner input = new Scanner (System.in;)
Int n;

String[]data = newString [10];
System.outprint(“Masukan jumlah data=”); n = input.nextInt();
for(int i=1;i<=n;i++){
System.out.print(“data ke”+i+”=”);data[i] = input.next();
}
String Gabung = “ ”;
for(int  i =1; i<=n;i++){
                gabung= gabung+data [i];
System.out.print(”hasil=”+gabung);
}
}


Latihan Java 2 with (Array)
Import java.util.Scanner;
    Public classdata
         {
                Public static void main(String[]arg)
               {
Scanner input = new Scanner (System.in;)
System.out.print(“Masukan jumlah data=”);
Int data = input.nextInt();
for(int i=1;i<=n;i++){
System.out.print(“data =”);
String data 1= input next();
data 2 = data2+ “  ” +data1;
System.out.print(”hasil=”+data2);
}
       }
}


String[]data = newString [10];
System.outprint(“Masukan jumlah data=”);n = input.nextInt();
data[i] = input.next();
}
String Gabung = “ ”;
for(int  i =1; i<=n;i++){
                gabung= gabung+data [i];
System.out.print(”hasil=”+gabung);
}
}





Mumtazain Designed by Mumtazain | Blogger Templates Copyright © 2014

Faris _elmumtazain. Gambar tema oleh richcano. Diberdayakan oleh Blogger.