Rohit Gupta
What is an Object in Java? How Do we create an Object in Java?
By Rohit Gupta in Java on Sep 10 2019
  • Laxmidhar Sahoo
    Jan, 2020 8

    We can’t instantiate an interface in java . We can create object of the implemented class .But the instance of Interfaceinterface Pet{public void test(); } class Dog implements Pet{public void test(){System.out.println("Interface Method Implemented");}public static void main(String args[]){Pet p = new Dog();p.test();} }

    • 0
  • Vijay Kumari
    Sep, 2019 16

    An object is a basic concept of oops like java classes .objects like an entity, which has a state and behavior.
    Objects represent identity, which uniquely identifies it. Like one car number plate is a different number of other cars. so, it is the car’s identity which is unique.
    In Java new keyword is used to create an object.

    Syntax:

    1. <class-name> [object-name] = new <class-default-constructor>

    For a detailed tutorial about Objects in Java, visit
    https://www.c-sharpcorner.com/article/a-complete-java-classes-tutorial/

    • 0


Most Popular Job Functions


MOST LIKED QUESTIONS