A friendly place for programming greenhorns!
Big Moose Saloon
Search
|
Java FAQ
|
Recent Topics
Register / Login
Win a copy of
The Mikado Method
this week in the
Agile and other Processes
forum!
JavaRanch
»
Java Forums
»
Certification
»
Programmer Certification (SCJP/OCPJP)
Author
arithmetic promotion
luk Hann
Ranch Hand
Joined: Jan 29, 2001
Posts: 48
posted
Feb 24, 2001 08:16:00
0
Please clear my doubt why no need of an explicit casting at line 1:
public class Tester { public static void main(String args[]) { int i=0; byte b=0; b+=b-(i=10); //line 1 System.out.println(b); } }
Thanks.
luk
Michael Burke
Ranch Hand
Joined: Jul 29, 2000
Posts: 103
posted
Feb 24, 2001 08:43:00
0
When you use the += operator the compiler performs an implicit cast for you.
I agree. Here's the link:
http://zeroturnaround.com/jrebel
- it saves me about five hours per week
subject: arithmetic promotion
Similar Threads
Just Don't Understand
A SCJP exam question (about array variable assign)
A question about "- -"
Array confusion
Doubt About the output of this Question
All times are in JavaRanch time: GMT-6 in summer, GMT-7 in winter