Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
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
How do I write class names in Java?
While writing class names you need to keep the following points in mind.
- You shouldn't use predefined or existing class names as the name of the current class.
- You shouldn't use any Java keywords as class name (with the same case).
- The First letter of the class name should be capital and remaining letters should be small (mixed case).
class Sample
- Likewise, first letter of each word in the name should be capital an remaining letters should be small.
class Test
- Keeping interface names simple and descriptive is suggestable.
- Better not to use acronyms while writing class names.
Example
public class Test {
public void sample() {
System.out.println("This is sample method");
}
public void demo() {
System.out.println("This is demo method");
}
public static void main(String args[]) {
Test obj = new Test();
obj.sample();
obj.demo();
}
}
Output
This is sample method This is demo method
Advertisements