• 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
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Final Variables are Very PowerFull (Check inside))

 
Ranch Hand
Posts: 110
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi all ranches,
Hope everyBudy fine Doing well in java. I was Shoked to c tht final variables are very powerfull (as long as they r compiled time Constant).just Check this out.
Class A
{
public static void main(String [] args)
{
final int F=10;
byte b=F;//will compile as F is a compile time constant
}
}
Opposite
Class A
{
public static void main(String [] args)
{
final int F=a();
byte b=F;//not compile as F is a not a compile time Constant
}
static int a()
{
return 1;
}
}
I can Say one Thing for Sure :-
JAVA is a Deep as OCEAN.

 
Ranch Hand
Posts: 91
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Good One.
Sure, when you thing that you know all, at that point also you may find some thing that are interesting.
But i think that one should be able to analyse new concepts in the light of old ones as you might already must have.
In first case the variable is initialized with a literal but in second case it is not.
 
reply
    Bookmark Topic Watch Topic
  • New Topic