Win a copy of Node.js Design Patterns: Design and implement production-grade Node.js applications using proven patterns and techniques this week in the Server-Side JavaScript and NodeJS forum!
  • 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
  • Rob Spoor
  • Tim Cooke
  • Junilu Lacar
Sheriffs:
  • Henry Wong
  • Liutauras Vilda
  • Jeanne Boyarsky
Saloon Keepers:
  • Jesse Silverman
  • Tim Holloway
  • Stephan van Hulst
  • Tim Moores
  • Carey Brown
Bartenders:
  • Al Hobbs
  • Mikalai Zaikin
  • Piet Souris

this is boggling me....Strings...aaahhhh

 
Ranch Hand
Posts: 123
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
public class WebAccounts
{
public static void main( String[] args )
{
// account details (username & password)
// email address (gathered from user)
// query fail (tell user account not found)
String details = "User Name: AAA\n";
details += "Pass Word: BBB";
String email = "";
String query_fail = "account not found";
// interaction with user
email = JOptionPane.showInputDialog( "Email Address:" );
// right email address entered
if( email == "tmwhalens@yahoo.com" )
{
JOptionPane.showMessageDialog
(
null,
details,
"Email Address Query Results",
JOptionPane.INFORMATION_MESSAGE
);
}
// wrong email address entered
else
{
JOptionPane.showMessageDialog
(
null,
query_fail,
"Email Address Query Results",
JOptionPane.INFORMATION_MESSAGE
);
}
}
}
 
Ranch Hand
Posts: 375
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Thomas,
I guess the problem is in the following statement --
if( email == "tmwhalens@yahoo.com" )
which checks for object refernces.
Try it with --
email.equals("whateva.com")
This statement will check for the character's & not object references.
Correct me if I'm wrong
Ashish
 
"The Hood"
Posts: 8521
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
This is a duplicate, so I am closing it.
reply
    Bookmark Topic Watch Topic
  • New Topic