4.java Class and Methods
4.java Class and Methods
class ClassName
{
data members declaration;
methods defination;
}
• The ClassName must begin with an alphabet, and the Upper-case letter is
preferred.
we must follow all naming rules.
class
• Java Class
o User defined class(Sample, Add, Student…etc)
o Pre defined/built-in class(Scanner,System,Thread…etc)
Object
• An object is an instance of type class.
• When an object of a class is created, the class is said to be instantiated.
• Objects created using a single class have the same properties and
methods of that class.
• We can create any no of Object for a class
• The value of properties is different for every object
• Syntax – Object creation
• ClassName objectName= new ClassName( );