Jeremy Hayes

Greenhorn
+ Follow
since Sep 10, 2009
Merit badge: grant badges
For More
Cows and Likes
Cows
Total received
In last 30 days
0
Forums and Threads

Recent posts by Jeremy Hayes

Hi,

I've spent a while working with Java, so the fact that moving to Android developement is not a huge leap, makes it more interesting to me than some other mobile OS's.

But the question I have is about the approach to take:

Could I write a pure Java application and easily port it to Android or would that be very difficult?

My limited understanding of Android programming suggests that it is a bit like working in a container ( like an applet or servlet container ).
Does that mean that an application written in pure Java would need a complete re-write to get it working on Android?

Thanks,
Jeremy
13 years ago
Firstly, I'd like to thank Henry Wong for his piece on this subject ( see the forum FAQ if you haven't seen it ).
I still have a few issues with this subject though. I should explain that there seems to be some incorrect or out of date info on Java constants on the web, which increases the confusion level.

So here are my questions/assumptions:

1. Do "Load time constants" exist?
I have seen some suggestions that they do, but the examples given fail to compile.
For example the code:

I've also read that emuns are load time constants that are somehow fudged to
work as switch case expressions by the compiler.

So my assumption is that there are only compile time constants. Am I correct?

2. The definition of the constant expression in the JLS makes no distinction between instance constants or class constants ( or any scope ).

Can I then assume that there are no differences or exceptions based on where the constant is defined?

3 As a follow up to point 2, why can't I use a final method parameter in a switch statement?

an example:

The constant 'one' above cannot be used in the switch, so:
a. Is it a constant?
b. What part of the JLS definition of the ConstantExpression does it break?
15 years ago