articles

Home / DeveloperSection / Articles / class in java

class in java

class in java

Ravi Vishwakarma671 01-Jul-2021

Class

A class is a prototype witch is create objects in opps programming. A class is combination of related fields and methods. This fields are public, private, protected, and final. And methods are static or non-static and final. There are many type of classes

  • Concrete class
  • Abstract class
  • Final class

 Concrete class

A concrete class is basically public class because it’s easily access by another class.

Syntax.

 Class class-name{

  Access specifier datatype variable-name 1

  Access specifier datatype variable-name 2

  Access specifier datatype variable-name n

  Access specifier datatype method-name(){

}

}

 Final class

A final class is not extended class in oops programming. Because final is a non-access key word so can’t be extend the final class

Syntax.

 final class class-name{

  Access specifier datatype variable-name 1

  Access specifier datatype variable-name 2

  Access specifier datatype variable-name n

  Access specifier datatype method-name(){

}

}

Example of class

 Class ClassDemo{

  private float PI=3.14159;

  public void setPIValue(float fl)

{

 PI=fl;

}

public float getPIValue()

{

 return this.PI;

}

}



Hi, my self Ravi Vishwakarma. I have completed my studies at SPICBB Varanasi. now I completed MCA with 76% form Veer Bahadur Singh Purvanchal University Jaunpur. SWE @ MindStick | Software Engineer | Web Developer | .Net Developer | Web Developer | Backend Engineer | .NET Core Developer

Leave Comment

Comments

Liked By