public class java8
{
public void amin(String nama)
{
System.out.print("halo, "+nama);
System.out.print(" ? piye kabere?? ");
}
}
yang memanggil:
import java.util.Scanner;
public class javaa8
{
public static void main(String[] args)
{
Scanner masukkan = new Scanner(System.in);
java8 asik = new java8();
System.out.print("monggo dipunketik asmanipun Panjenengan : ");
String nama = masukkan.nextLine();
asik.amin(nama);
}
}
output:
monggo dipunketik asmanipun Panjenengan :
'nama kamu'
(enter)
halo, 'nama kamu' ? piye kabare??