last day (14 days later) » 

01:49
0
A: Eclipse removes a necessary import when using "Organize imports"

TAskjava.lang is default package added to every java program so no need to import it and that's why eclipse removes import secondly to avoid conflict you should use fully qualified name cas.Integer in your project that's the convenient solution for you. You can not import both at a time import cas....

No... you see, I need to use java.lang.Integer. I do not need to use cas.Integer. The statement import java.lang.Integer works perfectly, to resolve the ambiguity; only Eclipse does not realize this.
I do not import cas.Integer, or anything from cas. The type is present in the namespace because my class is in package cas.
Yes but cas.Integer and java.lang.Integer is conflicting and only way to avoid is use fully qualified name cas.Integer
Perhaps it is not a widespread practice, but I hate to use fully qualified names. If I have import java.util.* and import javax.swing.* and they both have a Timer, then I can place an additional import java.util.Timer and then Timer refers to java.util.Timer. Despite being technically redundant, it does resolve the name conflict and ambiguity.
Yes that's why you should be specific while importing some class.Either of the timer can only be used with fully qualified name no other option.
Have you actually tried this in a class? import java.util.*; import javax.swing.*; import java.util.Timer does compile, and indeed if you then use Timer for a variable type it means java.util.Timer even if you do not provide a fully qualified path.
01:49
See java.util.Timer and javax.swingx.Timer is still conflicting if you import both.
Of course, this only works if both of the imports are implicit (i.e., using a .* import rather than an explicit import, or having the language implicitly import java.lang.* and having the other type implicitly imported via being in the same package cas.
I think to avoid conflict between two classes with same name you should go for fully qualified name as right now your Integer var; is refering to class inside your package and don't import java.lang.Integer
As compiler will first refer to the Integer created by you
I tested my code, and if I include import java.lang.Integer after package cas, then it will let me pass my Integers to methods that expect java.lang.Integer.
Are you sure i think it will consider it to cas.Integer and not java.lang.Integer??
I'll do an additional check, just to be sure...
Yep.
Here's a PasteBin.
02:12
So, uh... any suggestions now?

last day (14 days later) »