Home » Java programming language

Java Object Class final Class getClass() method with Example

Java Object class final Class getClass() method: Here, we are going to learn about the final Class getClass() method of Object class with its syntax and example.
Submitted by Preeti Jain, on June 28, 2019

Object Class final Class getClass()

  • This method is available in java.lang.Object.getClass().
  • This method is used to returns the Class class object.
  • The returned Class object is the object that is locked by static synchronized methods of the given class.
  • This method is final so we can't override it.


    final Class getClass(){


We don't pass any object as a parameter in the method of the Object class.

Return value:

The return type of this method is Class that means this method returns Class object.

Java program to demonstrate example of Object Class getClass() method

import java.lang.Object;

public class ObjectClass {

    // Java program to demonstrate working of 
    // getClass() method of Object class

    public static void main(String[] args) {
        Float fl = new Float(10.f);
        Class cl = fl.getClass();
        System.out.println("The name of Class of Float fl is : " +



D:\Programs>java ObjectClass
The name of Class of Float fl is : java.lang.Float


Comments and Discussions



Languages: » C » C++ » C++ STL » Java » Data Structure » C#.Net » Android » Kotlin » SQL
Web Technologies: » PHP » Python » JavaScript » CSS » Ajax » Node.js » Web programming/HTML
Solved programs: » C » C++ » DS » Java » C#
Aptitude que. & ans.: » C » C++ » Java » DBMS
Interview que. & ans.: » C » Embedded C » Java » SEO » HR
CS Subjects: » CS Basics » O.S. » Networks » DBMS » Embedded Systems » Cloud Computing
» Machine learning » CS Organizations » Linux » DOS
More: » Articles » Puzzles » News/Updates

© some rights reserved.