;

Java Program To Print Different Type of Values


Tutorialsrack 19/04/2021 Java

In this java program, you will learn how to declare, define different variables and print them on the display in Java. In this java program, we are going to declare and define some of the various types of variables and then, we’ll print them using the System.out.println() method.

Java Program To Print Different Type of Values

Java Program To Print Different Type of Values
//Java Program To Print Different Types of Values

public class JavaPrograms {

	public static void main(String[] args) {
	    
		int num; 
		float b; 
		char c; 
		String s; 
		
		//integer
		num     =       111; 
		//float
		b       =       1.234f; 
		//character
		c       =       'T'; 
		//string
		s       =       "Hello TutorialsRack"; 

		System.out.println("Value of num: "+num);
		System.out.println("Value of b: "+b);
		System.out.println("Value of c: "+c);
		System.out.println("Value of s: "+s); 
	  }
}
Output

Value of num: 111

Value of b: 1.234

Value of c: T

Value of s: Hello TutorialsRack


Related Posts



Comments

Recent Posts
Tags