How to create an object from a class
Syntax:
ClassName objectName = new ClassName(arguments);



*******************************************************
Example:

Scanner sc = new Scanner(System.in);
Date   now = new Date();

*******************************************************
How to call a method from an object
Syntax


objectName.methodName(arguments)


*******************************************************

double subtotal = sc.nextDouble();  //get a double entry from the console
String currentDate = now.toString();  // convert the date to a string


*******************************************************

how to call a static method from a class
Syntax:    ClassName.methodName(arguments);

String price = Double.toString(price);  // get a double entry from the console
double total = Double.parseDouble(userEntry);  //convert a string to a double





Site hosted by Angelfire.com: Build your free website today!