2. Java – Variables

public class VariableExample {
 public static void main(String[] args) 
{     
 int age;     
 char firstname[] = {'T','i','g','e','r'};     
 char lastname[] =  {'C','h','a','n'};     
 age = 18;     
 //Firstname     
 System.out.print("FirstName :");  
 System.out.print(firstname);     
  // new Line     
 System.out.println(""); 
 // new line "println" vs "print"     
 // Lastname     
 System.out.print("LastName :");  
 System.out.print(lastname);     
 // new Line     
 System.out.println("");     
 // Age     
 System.out.print("Age:");     
 System.out.print(age); }
 }

Note the difference between Println( ) vs Print( ) methods.

In Java we call all functions as methods. In C its called functions.

Output:

%d bloggers like this: