PENGENALAN JAVA
Coding JAVA
public class Hello
{
/**
* My first Java Program
*/
public static void main( String[] args){
//prints the string Hello world! on screen
System.out.println("Hello world!");
}
}
Cara
menjalankan menggunakan CMD:
cd..
cd..
seterusnya
javac Hello.java
java Hello
dir/w
Kalo
sudah ada file Hello.class brarti sudah benar.
Cara yang kedua
Coding
public class Hello
{
/**
* My first Java Program
*/
public static void main( String[] args){
//prints the string Hello world! on screen
System.out.println("Hello world!");
}
}
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);
}
}
Cara
menjalankan
javac Hello.java
dir/w
Kalo sudah ada OutputVariable.class
berarti sudah benar
Comments