Interviewer And Interviewee Guide

Java Software Engineer Interview Question:

int a = 1L;
won't compile and int b = 0;
b += 1L;
compiles fine. Explain me why?

Submitted by: Muhammad
When += is used, that's a compound statement and the compiler internally casts it. Whereas in the first case, the compiler straightaway shouts at you since it is a direct statement.

Compiler behavior and statement types can be confusing, so questions like this will test a candidate's grasp of these concepts.
Submitted by: Muhammad

Read Online Java Software Engineer Job Interview Questions And Answers
Copyright 2007-2024 by Interview Questions Answers .ORG All Rights Reserved.
https://InterviewQuestionsAnswers.ORG.