Data Types and Naming Conventions in Java

Data Types in Java

  • Used to represent the type of memory allocation.
  • Used with variables and methods.
  • These are fixed.
Data Types in Java

Primitive Data Types

Primitive data types are defined already by the programming
language. In Java there are 8 primitive data types.
Primitive Data Types

Non-Primitive Data Types

Non-Primitive data types are defined by the user. They are
Class, Array, Interface and String.

Naming Conventions in Java

There are few naming conventions defined by the Java language that should be kept in mind while giving name of a class, interface,
function, etc.
  • Class and Interface: First letter of each word should be
    uppercase. Ex: MyClassName.
  • Method: First letter of first word is lowercase while
    first letter of other words is uppercase. Ex: myMethodName().
  • Package and Keyword: In lowercase. Ex: int, float, static,
    etc.
If you find anything missing or wrong in above tutorial then please mention it by commenting below.

Leave a Comment

Your email address will not be published. Required fields are marked *