- Trending Categories
- Data Structure
- Operating System
- MS Excel
- C Programming
- 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
How many ways can get the instance of a Class class in Java?
You can create an object of the class named Class in two ways −
Using new keyword as −
Class obj = new Class();
Using the forName() method of the class named Class.
Class obj = Class.forName("DemoTest");
- Related Articles
- How many ways are there to initialize the instance variables of a class in java?
- How to get the class name of an instance in Python?
- When can a .class file get created in Java?
- Class with a constructor to initialize instance variables in Java
- Get the unqualified name of a class in Java
- Class & Instance Attributes in Python
- How to implement an instance method reference using a class name in Java?
- The get() method of AbstractList class in Java
- Class that contains a String instance variable and methods to set and get its value in Java
- Get the fully-qualified name of a class in Java
- The get() method of Java AbstractSequentialList class
- In how many ways you can retrieve the elements of a collection in Java?
- What is the difference between class variables and instance variables in Java?
- Can private methods of a class be accessed from outside of a class in Java?
- How many ways a String object can be created in java?