Welcome to Gaia! ::

pocketmonsterr6's avatar
  • 100
  • 150
  • 50
Hi, I just started to take a computer programming class, and Im having trouble understanding how to write out a String variable into standard output. Any tips or advice?
Sitwon's avatar
  • 50
  • 100
  • 150
Umm... it would probably help out a whole lot if you told us what language you were using. Otherwise all I can tell you is read the book and ask your teacher.
pocketmonsterr6's avatar
  • 100
  • 150
  • 50
Oh! Im terribly sorry, I completely forgot.
Im using java.
pocketmonsterr6
Oh! Im terribly sorry, I completely forgot.
Im using java.
System.out.println(yourString) ;
pocketmonsterr6's avatar
  • 100
  • 150
  • 50
psychic stalker
pocketmonsterr6
Oh! Im terribly sorry, I completely forgot.
Im using java.
System.out.printlnyourString) ;

So if my String variable is named message, and it just wants to see the variable on the screen, it would just be
System.out.println (message)

Cause I've been entering that in myProgramminglab and it's counting my code as incorrect.
Sitwon's avatar
  • 50
  • 100
  • 150
pocketmonsterr6
psychic stalker
pocketmonsterr6
Oh! Im terribly sorry, I completely forgot.
Im using java.
System.out.printlnyourString) ;

So if my String variable is named message, and it just wants to see the variable on the screen, it would just be
System.out.println (message)

Cause I've been entering that in myProgramminglab and it's counting my code as incorrect.
What is the exact error message?
pocketmonsterr6's avatar
  • 100
  • 150
  • 50
Sitwon
pocketmonsterr6
psychic stalker
pocketmonsterr6
Oh! Im terribly sorry, I completely forgot.
Im using java.
System.out.printlnyourString) ;

So if my String variable is named message, and it just wants to see the variable on the screen, it would just be
System.out.println message)

Cause Ive been entering that in myProgramminglab and its counting my code as incorrect.
What is the exact error message?

MyProgramminglab highlights the errors and throughout the code only println is highlighted and it says, This may need to be replaced. and thats where I get confused.
Want to copy your code to pastebin or gist.github.com and show it to us?
Sitwon's avatar
  • 50
  • 100
  • 150
pocketmonsterr6
Sitwon
pocketmonsterr6
psychic stalker
pocketmonsterr6
Oh! Im terribly sorry, I completely forgot.
Im using java.
System.out.printlnyourString) ;

So if my String variable is named message, and it just wants to see the variable on the screen, it would just be
System.out.println message)

Cause Ive been entering that in myProgramminglab and its counting my code as incorrect.
What is the exact error message?

MyProgramminglab highlights the errors and throughout the code only println is highlighted and it says, This may need to be replaced. and thats where I get confused.
I am not familiar with "MyProgramminglab", can you show us a screenshot?
pocketmonsterr6's avatar
  • 100
  • 150
  • 50
Sitwon
pocketmonsterr6
Sitwon
pocketmonsterr6
psychic stalker
pocketmonsterr6
Oh! Im terribly sorry, I completely forgot.
Im using java.
System.out.printlnyourString) ;

So if my String variable is named message, and it just wants to see the variable on the screen, it would just be
System.out.println message)

Cause Ive been entering that in myProgramminglab and its counting my code as incorrect.
What is the exact error message?

MyProgramminglab highlights the errors and throughout the code only println is highlighted and it says, This may need to be replaced. and thats where I get confused.
I am not familiar with "MyProgramminglab", can you show us a screenshot?

The Question
The Result

Edit:
This one shows the replace alert.
Sitwon's avatar
  • 50
  • 100
  • 150
pocketmonsterr6
Sitwon
pocketmonsterr6
Sitwon
pocketmonsterr6

So if my String variable is named message, and it just wants to see the variable on the screen, it would just be
System.out.println message)

Cause Ive been entering that in myProgramminglab and its counting my code as incorrect.
What is the exact error message?

MyProgramminglab highlights the errors and throughout the code only println is highlighted and it says, This may need to be replaced. and thats where I get confused.
I am not familiar with "MyProgramminglab", can you show us a screenshot?

The Question
The Result

Edit:
This one shows the replace alert.
That's strange, because it appears that you typed that command exactly right according to the question.
You could try using 'print' instead of 'println'.

What book/course are you using? I want to add it to my list of things NOT to recommend.
pocketmonsterr6's avatar
  • 100
  • 150
  • 50
Sitwon
pocketmonsterr6
Sitwon
pocketmonsterr6
Sitwon
pocketmonsterr6

So if my String variable is named message, and it just wants to see the variable on the screen, it would just be
System.out.println message)

Cause Ive been entering that in myProgramminglab and its counting my code as incorrect.
What is the exact error message?

MyProgramminglab highlights the errors and throughout the code only println is highlighted and it says, This may need to be replaced. and thats where I get confused.
I am not familiar with "MyProgramminglab", can you show us a screenshot?

The Question
The Result

Edit:
This one shows the replace alert.
That's strange, because it appears that you typed that command exactly right according to the question.
You could try using 'print' instead of 'println'.

What book/course are you using? I want to add it to my list of things NOT to recommend.


Yeah, that was it. It just wanted print, not println. emotion_facepalm
The book is called Java Software Solutions: Foundations of Program Design, myProgramminglab is based off the book, and my class just uses this as a means of practice exercises.

Anyways, I thank you all very much. I sincerely appreciate the help, as I have no other programmers as friends.
Yipes!

The Amazon reviews on that book are not friendly. Even the people who really like it have serious complaints.
pocketmonsterr6's avatar
  • 100
  • 150
  • 50
I hope the book for the next class is better. stare
From a purely pedantic, classroomy kind of way, print is technically the more correct answer, since it's not calling for a newline.

Quick Reply

Submit
Manage Your Items
Other Stuff
Get Items
Get Gaia Cash
Where Everyone Hangs Out
Other Community Areas
Virtual Spaces
Fun Stuff