Java Basic Activities : Character Data type

Character Data Type 



===============
Code: 
===============

public class Test5_Pereda {

public static void main(String [] args) {

char x = 'A';
char y = 'B';

System.out.println("Value of the variable: " + x);
System.out.print("Value of the variable: "   + y);

}
}



TO concatenate the string and the value of a variable



==============
Code: 
===============

public class Test6_Pereda {

public static void main(String [] args) {

char x = 'A';
char y = 'B';

System.out.println("Variable x is equal to " +x+ " and y is equal to " +y );
}
}


=============================
To display the value  of a variable with char data type one by one



======================
Code 
======================
public class Test8_Pereda {

public static void main(String [] args) {

char x1 = 'S';
char x2 = 'O';
char x3 = 'N';
char x4 = 'N';
char x5 = 'Y';
char x6 = 'P';
char x7 = 'E';
char x8 = 'R';
char x9 = 'E';
char x10 = 'D';
char x11 = 'A';


System.out.println(x1);
System.out.println(x2);
System.out.println(x3);
System.out.println(x4);
System.out.println(x5);
System.out.println(x6);
System.out.println(x7);
System.out.println(x8);
System.out.println(x9);
System.out.println(x10);
System.out.println(x11);


}
}

================================







































Walang komento:

Mag-post ng isang Komento