Search...
FAQs
Subscribe
Pie
FAQs
Recent topics
Flagged topics
Hot topics
Best topics
Search...
Search within Beginning Java
Search Coderanch
Advance search
Google search
Register / Login
Forums
Register
Login
Java
»
Beginning Java
Why still waiting for first name while I supplied "Avinash"
Avinash Oak
,
Greenhorn
Jun 12, 2012 04:46:29
(0 cow)
(0 skulls)
+Pie
Number of slices to send:
Send
package testing_different_resources; import java.util.Scanner; public class GeneralInput { public static void main(String[]args){ String name; String lastname; Scanner scnr = new Scanner(System.in); System.out.println("Please enter your First name and last name!"); do{ System.out.println("First Name :"); name = scnr.next(); }while(name!="Avinash"); System.out.println("Last Name :"); lastname= scnr.next(); System.out.println("Hi "+name+" "+lastname+" welcome to Java!"); } }
[Added code tags -
UseCodeTags
]
Suresh Sajja
,
Ranch Hand
Jun 12, 2012 04:58:27
(0 cow)
(0 skulls)
+Pie
Number of slices to send:
Send
Hi,
if you want to
test
if two strings have the same value
you should
use .equals
== is for testing weather two strings are the same object.
--Suresh
Avinash Oak
,
Greenhorn
Jun 12, 2012 05:01:47
(0 cow)
(0 skulls)
+Pie
Number of slices to send:
Send
Thanks Suresh!!
Its done..
Winston Gutkowski
,
Bartender
staff
Jun 12, 2012 05:02:21
(0 cow)
(0 skulls)
+Pie
Number of slices to send:
Send
Avinash:
First: UseCodeTags (←click).
Second: Read the
HowToAskQuestionsOnJavaRanch
page. I'm afraid
doesn't tell us much.
Winston
Avinash Oak
,
Greenhorn
Jun 12, 2012 05:29:45
(0 cow)
(0 skulls)
+Pie
Number of slices to send:
Send
Winston :
Thanks for your advice, here I am new. I'll keep in mind while posting.
;)
Winston Gutkowski
,
Bartender
staff
Jun 12, 2012 05:55:38
(0 cow)
(0 skulls)
+Pie
Number of slices to send:
Send
Avinash Oak wrote:
Thanks for your advice, here I am new. I'll keep in mind while posting. ;)
No probs.
Winston
Post by:
autobot
What I don't understand is how they changed the earth's orbit to fit the metric calendar. Tiny ad:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
reply
reply
This thread has been viewed 597 times.
Similar Threads
Downcasting
about arrays
ClassCast Exception
Assigning an Array of One Type to its Supertype
cast question
More...
All times above are in ranch (not your local) time.
The current ranch time is
Mar 28, 2024 11:33:47
.