Java is a safe-type programming language so person who coding in Java need to indicate object's type. İf i must explain little more, just think about "4" or thinking about "Love" how can you say to computer that which one of number or string. That's why, variables are used in java.
Variables:
String: String is used to desribe characters more than one.
char:char is used to descrice a character.
int: int is used to describe integers.
float and double: These variabeles are used to describe decimal numbers.
boolean : boolean returns "0" or 1" .
byte: byte is used describe 8 byte integers.
long: longe s used describe 64 byte integers.
short: short is used describes 16 byte integers.
public class Main {public static void main(String[] args) {
String a="LOVE";
int b=4;long c=1521468348;char d='e';short f=4574;double p=4.22145;System.out.println(a);System.out.println(b);System.out.println(c);System.out.println(d);System.out.println(f);System.out.println(p);}
}OUTPUT:LOVE 4 1521468348 e 4574 4.22145
Comments
Post a Comment