// Java program using the void keyword
public class ExampleVoid {
public static void main( String[ ] args ) {
int x = 10;
ExampleVoid myObj = new ExampleVoid( x );
myMethod( myObj.x );
}
// a member variable
double x = 5.0;
// a constructor
public ExampleVoid( int x ) { this.x = x; }
// a member method
public static void myMethod( double x ) { System.out.print( x ); }
}
|