Michal Gadomski

Greenhorn
+ Follow
since May 09, 2019
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Michal Gadomski

Thank you for your answer . About table with long and Long -> how such table would look like considering float and Float? Just a sec ago I saw a task connected with float. One of answers looked like this:

final float FEE = 0.012;

And it was said that such notation is not legal. That it needs 'f' at the end. If we look at your table with long/Long, we can see that (according to that logic) in case of this float, we should see implicit (float) cast. But not. Is it some exception? It looks quite difficult.
2 months ago
Hi,

I would be grateful if someone could explain these three doubts connected with the OCA exam.

1) Literals vs. FLOAT, DOUBLE, LONG
Somewhere I found info that 'float' needs 'f' after literal. That 'long' needs 'l' after literal. That in case of 'double' it is optional to add 'd'.
But is there any difference in concept when we consider primitive vs. wrapper class? I ask because during going through practice exams sometimes I saw, for example, 'long'/'Long' (don't remember) without additional 'l'/'L' at the end of literal. Maybe there is even another cause of such situation? Maybe auto-boxing?

2) static Integer or static int - When it needs to be initalized?
I know that when we have static variable in interface, it must be initialized in declaration line / in initialization code block / in constructor.
If we have a class variable (not instance, not local) as far as I remember, it is also necessary to initialize it early, exactly in declaration line (I think).
Then what if we have an instance variable with 'static' and it is not initialized in declaration line? When we have to initialize it? Does it change anything if we consider primitve type vs. wrapper class?

3) import static
I have some problem here. I thought that using wildcard in the case of import static is not allowed (that you have to indicate exactly the method or the variable). But yesterday I saw an example where there was a '*' (wildcard) symbol involved.

Thank you in advance for your time.
Best regards
Mike
2 months ago