write a program to create variables of different types ( integer, floating-point, character, String, boolean) and initialize them, then display the values of variables with appropriate labels/messages
Answers
Answer:
Normally, a verbal communication takes place in real time. Written communication, by contrast, can be constructed over a longer period of time. Written communication is often asynchronous (occurring at different times). That is, the Sender can write a Message that the Receiver can read at any time, unlike a conversation that is carried on in real time. A written communication can also be read
Write a program to create variables of different types
Explanation:
Java program to display the values of variables with different data types
public class Main
{
public static void main (String[]args)
{
short temperature = -200;
int range = -4250000;
float number = -42.3f;
double b = 123.43555;
char c = 'e';
boolean d = true;
String s = "Hello World";
System.out.println("Short : " + temperature);
System.out.println("Integer : " + range);
System.out.println("Float : " + number);
System.out.println ("Double : " + b);
System.out.println ("Character : " + c);
System.out.println ("Boolean : " + d);
System.out.println ("String : " + s);
}
}
Output
Short : -200
Integer : -4250000
Float : -42.3
Double : 123.43555
Character : e
Boolean : true
String : Hello World