+ 1

If I want to print a word on java, I need to put "char" as character in front of the word?

char word= (name)

9th Feb 2017, 11:46 PM
Artjola Meli
Artjola Meli - avatar
2 Respostas
+ 1
I got it now, thank you @WALL-BUILDER
10th Feb 2017, 12:00 AM
Artjola Meli
Artjola Meli - avatar
0
Not exactly, the data type char is for single characters; 8 bits (1 byte). Strings are a class that contains multiple memory adresses, one for each character on the sentence. Therefore, to allocate memory for a word you shall use String type, in order to print a sentence. String var_name = "Hello World"; Char letter = 'a'; System.out.println(var_name); System.out.println(letter); Output: Hello World a
9th Feb 2017, 11:51 PM
WALL_BUILDER
WALL_BUILDER - avatar