Thursday, January 10, 2008

JAVA basics

This is a very simple program using java language. I'll just use this as my reference for our tonights exam. BCouz i'm not good at java and i can't memorize the codes even the basics. Hope we can use internet for our exam. Gud luck to me! :>

import javabook.*;

class trial
{
public static void main(String args[])
{
MainWindow main=new MainWindow("Trial");
OutputBox ob = new OutputBox(main);
InputBox ib=new InputBox(main);

main.setVisible(true);
ob.setVisible(true);

int age, x;
age=ib.getInteger("What age?");
x=ib.getInteger("Pila?");
for(int y=0;y...
{
if(age>10 && age<20)
{
ob.printLine("teen");
}
else if(age>19)
{
ob.printLine("Waaa tigulang ka na!");
}
else
{
ob.printLine("Bata pa ka dong!");
}
}

}
}