Welcome to the Java Programming Forums

The professional, friendly Java community. 21,500 members and growing!

The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.


Members have full access to the forums. Advertisements are removed for registered users.

Results 1 to 2 of 2

Thread: the != statement

  1. #1
    Junior Member
    Join Date
    Dec 2018
    Thanked 0 Times in 0 Posts

    Default the != statement

    I'm going over some lessons on how to write in Java and I found this one lesson that talked about using the != to check to make sure a variable is not equal to a specific value. Can you also say <> instead? Wouldn't that not give you the same result?

  2. #2
    Super Moderator Norm's Avatar
    Join Date
    May 2010
    Eastern Florida
    Thanked 2,455 Times in 2,406 Posts

    Default Re: the != statement

    Have you tried it to see what happens? Write a short simple program that uses both operators. Compile and execute it to see what happens.
    Post the code here and the results if you have any questions.

    Note: != is not a statement, it is an operator for comparing two values.
    If you don't understand my answer, don't ignore it, ask a question.

Similar Threads

  1. Replies: 0
    Last Post: January 22nd, 2018, 04:59 PM
  2. How to turn my If statement into a case/switch statement?
    By blobby404 in forum What's Wrong With My Code?
    Replies: 23
    Last Post: June 19th, 2014, 03:11 PM
  3. Replies: 2
    Last Post: June 25th, 2013, 06:33 AM
  4. [SOLVED] A Loop statement and a switch statement issue
    By sternfox in forum Loops & Control Statements
    Replies: 13
    Last Post: March 7th, 2013, 04:19 PM
  5. Replacing an If statement with a Switch statement
    By logi in forum Loops & Control Statements
    Replies: 9
    Last Post: February 4th, 2013, 12:21 AM