ARRAY
package newpackage;/*
nama package harus sama
*/
import java.util.Scanner;
nama package harus sama
*/
import java.util.Scanner;
public class DataArray /*
nama Class harus sama
*/
{
nama Class harus sama
*/
{
public static void main(String[] args){
Scanner input = new Scanner(System.in);
int n;
String[] data = new String[10];
System.out.print("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);
}
}
}
0 komentar:
Posting Komentar