Search...
FAQs
Subscribe
Pie
FAQs
Recent topics
Flagged topics
Hot topics
Best topics
Search...
Search within OCPJP
Search Coderanch
Advance search
Google search
Register / Login
Help coderanch get a
new server
by contributing to the
fundraiser
Post Reply
Bookmark Topic
Watch Topic
New Topic
programming forums
Java
Mobile
Certification
Databases
Caching
Books
Engineering
Micro Controllers
OS
Languages
Paradigms
IDEs
Build Tools
Frameworks
Application Servers
Open Source
This Site
Careers
Other
Pie Elite
all forums
this forum made possible by our volunteer staff, including ...
Marshals:
Campbell Ritchie
Ron McLeod
Paul Clapham
Devaka Cooray
Liutauras Vilda
Sheriffs:
Jeanne Boyarsky
paul wheaton
Henry Wong
Saloon Keepers:
Stephan van Hulst
Tim Holloway
Tim Moores
Carey Brown
Mikalai Zaikin
Bartenders:
Lou Hamers
Piet Souris
Frits Walraven
Forum:
Programmer Certification (OCPJP)
about if-else
ming ming
Ranch Hand
Posts: 54
posted 18 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
import java.util.*; public class First { public static void main(String[] args) { Scanner scan=new Scanner(System.in); String name=null; System.out.println("Please insert a name"); name=scan.nextLine(); if(name=="Jason"){ System.out.println("Jason"); } else if(name=="Tomm"){ System.out.println("Tomm"); } else if(name=="Robert"){ System.out.println("Robert"); } } }
In the above code y when i enter the name "Jason", it will not display the name???
wise owen
Ranch Hand
Posts: 2023
posted 18 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
if ("Jason".equals(name)){
...
}
Did you see how Paul
cut 87% off of his electric heat bill with 82 watts of micro heaters
?
reply
reply
Bookmark Topic
Watch Topic
New Topic
Boost this thread!
Similar Threads
is there a quicker way to read in input besides bufferedreader?
looped menu
err get and set methods and scanner class / JOptionPane
Java Array search and print
How to check entered value is of which primitive type?
More...