Win a copy of Pragmatic AI this week in the Artificial Intelligence forum!
  • 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Jeanne Boyarsky
  • Liutauras Vilda
  • Campbell Ritchie
  • Tim Cooke
  • Bear Bibeault
Sheriffs:
  • Paul Clapham
  • Junilu Lacar
  • Knute Snortum
Saloon Keepers:
  • Ron McLeod
  • Ganesh Patekar
  • Tim Moores
  • Pete Letkeman
  • Stephan van Hulst
Bartenders:
  • Carey Brown
  • Tim Holloway
  • Joe Ess

transient  RSS feed

 
Ranch Hand
Posts: 42
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi everybody,
Can any one clarify the follwing doubts
1. Why the transient variables may not be final , static or synchronous?
2.Can an innerclass is abstract? then why?
3. See the following code..
class Q14 {
2. public static void main(String[] args) {
3. int intNumber = 123456789;
4. float floatNumber = intNumber;
5. int x = (int)floatNumber;
6. System.out.println(intNumber - x); // -3
7. System.out.println(intNumber == x ); //False
System.out.println(Integer.MAX_VALUE+" "+x);//2147483647 123456792
8. }
9.}
Why the value of X is not same before and after assinging to float?
 
Ranch Hand
Posts: 84
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
<pre>Originally posted by suresh seeram:
Can any one clarify the following doubts
2.Can an innerclass be abstract? then why?
</pre>

An abstract class must be subclassed to be useful. Are you going to subclass your innerclass as a second inner class? Why?
3. See the following code..

<pre>Why is the value of X is not same before and after assigning to float?</pre>

Because of the way the computer stores floats.
 
Ranch Hand
Posts: 139
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator


Can any one clarify the follwing doubts
1. Why the transient variables may not be final , static or synchronous?
2.Can an innerclass is abstract? then why?


1. First of all, synchronized (there is no keyword synchronous)
is not applicable to variable.
Secondly, a variable can be transient, final and static.
There is no restriction.
But, transient static combination doesn't make too much sense since transient usually applies to instance variable.
2. An inner class can be declared as abstract. There is
simply no reason to prohibit it. (See InnerClass Specification
p.16)

[This message has been edited by Nain Hwu (edited October 09, 2001).]
 
suresh seeram
Ranch Hand
Posts: 42
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi marily and Nain,
thanks for your quick response..
 
Consider Paul's rocket mass heater.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!