Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6747833
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T12:29:34+00:00 2026-05-26T12:29:34+00:00

In my Java book, it says that an expression is a statement that can

  • 0

In my Java book, it says that “an expression is a statement that can convey a return value.” This is different than my traditional understanding. I thought an expression DOES return a value. Not CAN return a value.

this is from Sams Teach Yourself Java in 21 Days.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-26T12:29:35+00:00Added an answer on May 26, 2026 at 12:29 pm

    A mathematical expression always returns something, but a Java expression doesn’t have to. The Java Specification defines what exactly is meant by the term expression in the Java language. Another difference is that expressions can, and often do, have side effects in Java. A side effect is pretty much anything that happens other than returning a value.

    Quoting the Java Language Specification:

    Much of the work in a program is done by evaluating expressions, either for their side effects, such as assignments to variables, or for their values, which can be used as arguments or operands in larger expressions, or to affect the execution sequence in statements, or both.

    For example system.out.println("Hello World"); doesn’t return a value, but it does print Hello World to the output stream. This process of outputting data is a side effect of calling println. Functional languages, in contrast, attempt to minimize dependence on side effects and stick more closely to the mathematical definition of an expression.

    Quoting from the JLS again, here is the BNF grammar for an expression:

    Primary:
        PrimaryNoNewArray
        ArrayCreationExpression
    
    PrimaryNoNewArray:
        Literal
        Type . class 
        void . class 
        this
        ClassName.this
        ( Expression )
        ClassInstanceCreationExpression
        FieldAccess
        MethodInvocation
        ArrayAccess
    

    You can see that a MethodInvocation is an expansion of PrimaryNoNewArray, which is an expansion of Primary (expression).

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am reading a book about Java and it says that you can declare
Can somebody tell me what does this mean? I'm going trough Java book and
I just read this statement in a java book saying Objects in java reside
In the book Effective Java, Josh Bloch says that StringBuffer is largely obsolete and
Java provides built-in support for multithreaded programming. That is what my book says. I
I have seen Java code that says something like: SomeClass.this.someMethod(someArg); Blah(AnotherClass.class); Blah(YAClass.this); What do
I remember reading in some Java book about any operator other than 'instanceof' for
I'm almost finished with the book Head First Java. The reason I'm studying this
I'm reading Sybex Complete Java 2 Certification Study Guide April 2005 (ISBN0782144195). This book
In Josh Bloch's excellent book Effective Java under Item 39 he says: [D]efensive copies

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.