Class

0 Abhinandan mittal · May 28, 2015
Can a java program be written wthout class?please explain.

Post a Reply

Replies

Oldest  Newest  Rating
0 Dol Lod · May 28, 2015
No because all methods must be declared inside classes. For a program to compile you need the method main in exactly one class and should be static. These class files are compiled into byte codes which are stored in .class files.

How compilation works:

javac a. java will produce the java.class file

Then you would run it by writing java a.

This compilation process absolutely must use the class files because nothing in java can be outside the class aside from import statements. 
  • 1

Java / Android Development

107,264 followers
About

Very popular language used to create desktop applications, website applets, and Android apps.

Links
Moderators
Bucky Roberts Administrator