Creating classes & objects
class Welcome
{
void sayHello( )
{
System.out.println(“ Welcome to you “);
}
public static void main( String [ ] args )
{
Welcome w = new Welcome ( );
w.sayHello( );
}
}
In Java,object should be created using new keyword.
Syntax :
In the above program,
Welcome w = new Welcome( ) ;
statement creates object w.
