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 8723813
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T07:42:21+00:00 2026-06-13T07:42:21+00:00

I am looking at the code on page 11 here http://www.cs.usfca.edu/~parrt/doc/java/JavaIO-notes.pdf I have trouble

  • 0

I am looking at the code on page 11 here http://www.cs.usfca.edu/~parrt/doc/java/JavaIO-notes.pdf

I have trouble with one statement. I thought the result of an assignment was an lvalue. So ((byteRead = inFile.read()) != -1) should be the same as (inFile.read()) != -1). This doesn’t seem to be the case though looking at the output. So my question is how is the statement ((byteRead = inFile.read()) != -1) parsed?

EDIT: It seems from the responses that I had the current interpretation of the result of an assignment. I was wondering what goes wrong by replacing the code fragment

int byteRead;

while((byteRead = inFile.read()) != -1)

outFile.write(byteRead);

with

while( inFile.read() != -1)

outFile.write( inFile.read());

  • 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-06-13T07:42:22+00:00Added an answer on June 13, 2026 at 7:42 am

    So, now that you posted both versions of code, the answer is clear:

    In your first version, each byte read is assigned to byteRead and then written to the output stream.

    In the second version, you consume a byte with the read() but don’t assign it to a variable. Then, you read another byte (the next one in the stream) which you write to the output stream.

    So, if the input file is:

    abcdefghijklmnopqrstuvwxyz
    

    The output of the first version will be :

    abcdefghijklmnopqrstuvwxyz
    

    The output of the second will be :

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

Sidebar

Related Questions

Was looking at the reference page here : http://www.w3.org/TR/html5/offline.html I copied and pasted the
Here's the page in question: http://www.lukaspleva.com/MoneyThink/NationalAdmin.php If you go to that page, you'll see
http://www.geneseo.edu/new_social_media_test I am working on a new social media page for my school, and
I was looking a source code of a particular page of my project and
I have been looking through code for the last 3 days, and the original
Looking at the layout here , I want to constrain the entire page's min
I have a page search in development here on the Table of Contents tab:
I have the following html page: What I am looking to do is capitalize
hopefully someone here will find the answer to this: Im looking to have a
I have this code here that should send off an alert... jQuery(.wpcart_gallery .thickbox).click(function($){ alert('hi');

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.