Online JAVA
Learn java easily
Saturday, December 3, 2016
Basic things for coding
Main Method
class ClassName{
//Body
}
Class is the basic element of the Object Oriented Programming.
A JAVA program is a collection of classes.
A class body contains
Collection of fields or variables (Attributes/Fields)
Operations performed on those fields (Behavior/Methods)
NOTE: Each and Everything (Except “importing packages”) in
a JAVA program should be included within a class.
Driver Class
Driver class contains the main method.
class HelloWorld{
public static void main(String[] args){
//method body
}
}
Naming Conventions for classes
1.The class names begin with upper case letters.
class Student{
public static void main(String[] args){
//method body
}
}
2.When there are more than one word to be combined, the subsequent words start with upper case letters or combine them using underscores(_).
class StudentDetails{ class Student_Details{
//method body //method body
} }
Subscribe to:
Posts (Atom)