Search...
FAQs
Subscribe
Pie
FAQs
Recent topics
Flagged topics
Hot topics
Best topics
Search...
Search within OCPJP
Search Coderanch
Advance search
Google search
Register / Login
Post Reply
Bookmark Topic
Watch Topic
New Topic
programming forums
Java
Mobile
Certification
Databases
Caching
Books
Engineering
Micro Controllers
OS
Languages
Paradigms
IDEs
Build Tools
Frameworks
Application Servers
Open Source
This Site
Careers
Other
Pie Elite
all forums
this forum made possible by our volunteer staff, including ...
Marshals:
Campbell Ritchie
Tim Cooke
paul wheaton
Jeanne Boyarsky
Ron McLeod
Sheriffs:
Paul Clapham
Liutauras Vilda
Devaka Cooray
Saloon Keepers:
Tim Holloway
Roland Mueller
Bartenders:
Forum:
Programmer Certification (OCPJP)
what is compile time constant?
rohit shekhar
Ranch Hand
Posts: 32
posted 12 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
The case constant must be a compile time constant!
Code :-
final int a =1; final int b; b=2; int x= 0; switch(x) { case a: //ok case b: // compile time error }
Q. Both variables are being initialized before use. And I think both have value before compilation. Then why b is not compile time constant.
Ref.
SCJP
java
6 study guide. Page 336
Rameshwar Soni
Ranch Hand
Posts: 247
posted 12 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
There is a good post from Henry Wong about
What is compile time constant
and it is
here
Whatever. Here's a tiny ad:
New web page for Paul's Rocket Mass Heaters movies
https://coderanch.com/t/785239/web-page-Paul-Rocket-Mass
reply
reply
Bookmark Topic
Watch Topic
New Topic
Boost this thread!
Similar Threads
constant inside the switch case
assignment problem
switch question
Switch case logic
compile time constant
More...