DEV Community

Naveen kumar
Naveen kumar

Posted on

Class and Object

Class:-

  1. Class is a java keyword
  2. Class is a template
  3. Class is logical entity

  4. Class name First letter should be the capital letter
    Eg. StudentName

  5. Class name should allow only these special characters like ($ & _)..( starting, intermediate and last)

  6. Class name should allows only numeric value like ( intermediate and last)

Syntax:
Class BikeShowroom
{
Code
}

OBJECT

  1. Object is a State and Behaviour
  2. Object is physical entity
  3. Object is used to store State and behaviour

Syntax
BikeShowroom ref = new BikeShowroom();

  1. New is a keyword of java

If we create a object, jvm will allocate a memory in heap at runtime

Top comments (0)