Java | Naming Conventions

05 min read

Naming Conventions in Java :

  • Source files are generally called as 'Complication units'.
  • Functions are called as 'Methods'.
  • All class names and interface names start with a leading uppercase letter. For example, System. If the class name contains multiple words, all the words are marked with a leading uppercase letter. Eg: PrintStream, FileOutputStream.
  • Names of all public methods and instance variables start with a leading lower case letter. When more than one word is used for a method name, second and subsequent words are marked with a leading uppercase letter. Eg: println(), toUpperCase(), isDirectory(), currentTimeMillis()
  • Private and local variables, package names are with lower case letters. Eg: awt, util, etc.
  • Generally, method names will be verbal phrases and class names will be nouns.
POST A NEW COMMENT
     
  • Input (stdin)

    Output (stdout)


    Input (stdin)

    Your Output (stdout)

    Expected Output

    Compiler Message

    Input (stdin)

    2    3

    Your Output (stdout)

    5

    Expected Output

    5

    Compiler Message

    5

    Error