CS 342 - 1/21/16 The layout of a Java Program import extends implements data member/instance variable declaration constructors static vs. non-static methods for non-static methods, there exists an implicit parameter that is a reference to the instance being used at the method call. This implicit parameter is named: this Assume the Point class has a method "distance from origin" Point pt1; Point pt2; ... System.out.println ( pt1.distFromOrigin () ); System.out.println ( pt2.distFromOrigin () ); class Point { int x; // "data member" or "instance variable" int y; double distFromOrigin () { double dist; int x; // local variable String y; dist = ..... this.x ...... this.y ..... ; // above uses the data member return dist; } } Example of a static method: Math.pow () for exponentiation Static methods have all "additional" information passed in through explicit parameters System.out.println ( Math.pow ( 5, 3) ); The first C++ "compliers": Would translate the call of: pt1.distFromOrigin (); to distFromOrigin ( pt1 ); And would translate the Method signature from double Point::distFromOrigin ( ) to double distFromOrigin ( Point* this ) Java Graphics 2 main librairies awt - Abstract Windowing Toolkit swing - Windowing Librries from Jave V2.0 All swing classes start with J 2 primary pieces: Component Container