- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
Physics
Chemistry
Biology
Mathematics
English
Economics
Psychology
Social Studies
Fashion Studies
Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
What is the class "class" in Java?
The Java.lang.Class class instance represent classes and interfaces in a running Java application. It has no public constructor.
Example
Following is the example demonstrates the usage of the class Class.
The java.lang.Class.getCanonicalName() method returns the canonical name of the underlying class as defined by the Java Language Specification. It returns null if the class does not have a canonical name.
import java.lang.*; public class ClassDemo { public static void main(String[] args) { ClassDemo c = new ClassDemo(); Class cls = c.getClass(); //Returns the canonical name of the underlying class if it exists System.out.println("Class = " + cls.getCanonicalName()); } }
Ouput
Class = com.tutorialspoint.ClassDemo
- Related Articles
- What is the super class of every class in Java?
- What is the root class in Java?
- What is the object class in Java?
- What is the Thread class in Java?
- What is the difference between Component class and Container class in Java?
- What is AbstractSequentialList class in Java?
- What is AbstractCollection class in Java?
- What is AbstractList Class in Java?
- What is Java String Class?
- What is the difference between abstract class and a concrete class in Java?
- What is StringJoiner class in Java 8?
- What is a static class in Java?
- What is a singleton class in Java?
- What is a Throwable class in Java?
- What is a Locale class in Java?

Advertisements