Character Variable Type In Java
To store characters we can use character type.
char
is the keyword to do this.
You should type the character between two single quotation marks. (‘A’)
The string
is the keyword to store many characters.
You should type the string
between two double quotation marks. (“”)
We can combine strings with a plus +
package variables.Variables;
public class TheCharecter {
public static void main(String[] args) {
char character = 'A';
System.out.println(character);
String name = "Dedunu";
String surname = "Uduwewelage";
System.out.println(name + " " + surname);
}
}