What is Class in Java Programming Langauge?

//Class:-

  • //Class is collection of Member Function (Methods), Printing Statements, Scanning Statments, Constructor, object, variable, datatypes,and so on.
  • //Member function called as Methods
  • //We can say that a class can be defined behaviour/state that the object of it's type support.
  • //right click on Package-->New-->Class-->Write Class Name-->Finsh.

//Rules Related the class :-

  • //1.Complete code will be inside the class.
  • //2.Class Name should not have spaces.
  • //3.First Name of Class cannot integer value.
  • //4.First Letter should always capital of every word.
  • //5.to change the name of the class.
    • Right click on class name-->click on Refactor-->Rename-->Write new name-->Finish.
    • //ex.of class name is--> StudyOfClass.
====================================================================

//Program I:-

package studyOfProject;

public class StudyOfClass

{                    

           public static void main(String [] args) // Main Method

                 {

                   Project p=new Project(); // Object created

                 }                    

           public static void test1() // static regular Method

                 {

                   int a=22; // int--> datatype, a--> variable

                 }                    

           public void test2() // non static regular method without Parameter

                 {

                   System.out.println("Hi"); //Printing Statements

                 }                    

           public Project() // user defined constructor without Parameter

                 {                          

                 }

}

====================================================================