Showing posts with label Mencetak Variabel. Show all posts
Showing posts with label Mencetak Variabel. Show all posts

Friday, 24 August 2012

Menampilkan Data Variabel


Untuk mengeluarkan nilai dari variabel yang diinginkan, kita dapat menggunakan perintah sebagai berikut,


System.out.println()
System.out.print()


Berikut ini adalah contoh program,


public class OutputVariable
{
public static void main( String[] args ){
int value = 10;
char x;
x = 'A';
System.out.println( value );
System.out.println( "The value of x=" + x );
}
}


Program tersebut akan mengeluarkan teks berikut pada layar,


10
The value of x=A




Sumber : J.E.N.I