DEV Community

Akash
Akash

Posted on

Datatypes in java,Creating Class in Java

=> Datatypes in java

1. Primitive Datatype

  • Byte
  • Short
  • int
  • long
  • float
  • double
  • boolean

2. Non-Primitive Datatypes

  • String
  • Arrays
  • Classes
  • Interfaces

*=> There are several important rules in java for creating class
*

1.Keyword is Mandatory(class)
2.Class name should start with uppercase
3.Java is case-sensitive
4.Keywords must be lowercase
5.Leaving Spaces not allowed in class names

=> Declaring variable

int - Datatype
age - Variable name
= - Assignment operator
22 - Value

OUTPUT:

  • A variable declared inside the main() method is called a local variable.
  • Can be accessed using the class name
  • It can only be accessed inside main().

1.Game.name
2.Game.age
3.Game.qualification

Top comments (0)