 
 Data Structure Data Structure
 Networking Networking
 RDBMS RDBMS
 Operating System Operating System
 Java Java
 MS Excel MS Excel
 iOS iOS
 HTML HTML
 CSS CSS
 Android Android
 Python Python
 C Programming C Programming
 C++ C++
 C# C#
 MongoDB MongoDB
 MySQL MySQL
 Javascript Javascript
 PHP PHP
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Using predefined class name as Class or Variable name in Java
Using a predefined class name as a class name
Let us see an example −
Example
public class Number{
   public static void main (String[] args){
      System.out.println("Pre-defined class name can be used as a class name");
   }
}
Output
Pre-defined class name can be used as a class name
The class Number has a main function that displays a message when it is executed. The main function takes string values as arguments.
Using a predefined class name as a variable name
Let us see an example −
Example
public class String{
   public static void main (java.lang.String[] args){
      System.out.println("Pre-defined class name can be used as a variable");
   }
}
Output
Pre-defined class name can be used as a variable
The String class has the main function that displays a relevant message on the console. Here, the only difference is that the main function doesn’t take the String values as arguments, insatead the java.lang.String class explicitly as argument. Otherwise, this results in an error.
Advertisements
                    