Skip to content

Instantly share code, notes, and snippets.

@josephkandi
Created May 6, 2016 08:00
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save josephkandi/6eaedcc14a5deb8bdcc354db83cf1984 to your computer and use it in GitHub Desktop.
Save josephkandi/6eaedcc14a5deb8bdcc354db83cf1984 to your computer and use it in GitHub Desktop.
class CharDemo {
public static void main (String[] args) {
//The char data type is represented internally as a number
//It holds a single unicode character
char correctAnserOption = 'A';
//The unicode value for the @ sign is 64.
char atSign = 64;
System.out.println(atSign);
//You can also use it to display non-printable characters
//You use a backslash to represent non-printable characters
//Here is a tab key
char tab = '\t';
System.out.println("Hello" + tab + "There");
//TODO
//Try adding a newline instead of a tab between Hello and There
//HINT - The newline character is represented by n
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment