The Java Platform Java Runtime Environment Data Types Control Statemets Methods Arrays Classes and Objects![]() Objectives![]() Classes and Objects?![]() Instance and Class Members![]() Class Constructor![]() Example![]() Class members![]() Abstraction![]() Object Reference Inheritance Constructor Interface Packages & Access Modifiers Java Collections Framework | Class members
NoteClass members maintain only one copy in memory. Therefore, even though you may have instantiated many instances of a class, each member that is declated as static will be stored across all instances of that class. This is similar to the concept of global variables, but the word global is not acceptable in OO concepts. class MathClassMember {
static void main(String[] args) {
double deg = Double.parseDouble(args[0]); //class method parseDouble
System.out.println("sin(" + deg + ") = " +
Math.sin(deg));
}
} |