1st PROG IN JAVA.
class ClassName // 1st ch should be capital(optional) of every major word of class name..
{
public static void main (String args [ ] )
{
System.out.println (''welcome to java'');
}
}
public: cuz JVM will call it outside class,
static: as prog'll load an obj will be created automatically.(static means that method s same for all instances of class),
Strings args: main method take one parameter args which s an array of strings objects that represent command line argument passed to the class upon execution as this prog doesn’t use any command line argument so we can omit args parameter here.
print =cout, ln=/n, system.out = outer sys (monitor), dot (.) s used to show that out s a subpackage of system & print s a subpackage of out..
SAVE ::Write this above prog n any editor & save it by same name as class name & with extinsion .java…it’s recommended but not necessary. But if we write “ public class ClassName “ then it’s compulsory to save it with same name as class name.
COMPILE ::on command prompt type javac ClassName.java (class name case sensitive at compilation time)
RUN :: java classname press enter (class name not case sensitive at run time)
cout means console Out..
.class: In other languages .EXE s created but n java .class s created