Docy

Characters

Estimated reading: 1 minute 847 views

Characters

The char data type is used to store a single character. The character must be surrounded by single quotes, like ‘A’ or ‘c’:

Example

				
					char myGrade = 'B';
System.out.println(myGrade);
				
			

Strings

The String data type is used to store a sequence of characters (text). String values must be surrounded by double quotes:

Example

				
					String greeting = "Hello World";
System.out.println(greeting);
				
			

Leave a Comment

Share this Doc
CONTENTS