Welcome to the CSC Q&A, where you can get help (and share your knowledge) about computer science!

What is a string variable and why is it used in self-check 2.6? i.e. comparison to "double" or "int"

+2 votes
asked Sep 7 in CSC 211 (F17) by Keri Meinert (420 points)

1 Answer

+1 vote
A String variable is basically just words. Like in: System.out.println("This is a string");

So if you declare a string variable, you type: String nameOfString = "Words of the String";

For self check 2.6, it is asking for you to say what type of variable that it uses. I didn't use String in it when I first did it. If it's a string variable, it has to consist of words. We had only gone over int and double in class, but there are others covered in the book such as boolean and string and character (char).
answered Sep 7 by Kathryn Clark (1,391 points)
Thank you, Kathyrn! I guess it pays to read the book, be resourceful, and not depend on the teacher to teach everything:)