Mike Lin

Ranch Hand
+ Follow
since Oct 29, 2002
Merit badge: grant badges
For More
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 Mike Lin

Hi ,all,I meet a confused compile question today.
create two java source file named T1.java and T2.java in the same directory,then comiple them.
T1.java

T2.java

compile T1 first ,then compile T2.Nothing exceptions happen.
But change

to


in T2.java,a compile error happens.compile messages like these:


Yet ,what's the difference between import p1.* and import p1.T1


EDIT by mw: Broke up really long error message line in code tags.
[ October 10, 2006: Message edited by: marc weber ]
thank you ,Jesper .
Yet ,when I comiple T1.java ,I user param "-d ." .so package p1 is auto created after compile.
The focus here is not how to compile it successfully but WHY WE CANNOT REPLACE import p1.* WITH import p1.T1 ??

what's the diffrence between them?

bty,Paul ,I think it's a advaned question.
I have passed SCJP1.4 four yeas ago!

[ October 10, 2006: Message edited by: Mike Lin ]

[ October 10, 2006: Message edited by: Mike Lin ]
[ October 10, 2006: Message edited by: Mike Lin ]
17 years ago
Hi ,all,I meet a confused compile question today.
create two java source file named T1.java and T2.java in the same directory,then comiple them.
T1.java

T2.java

compile T1 first ,then compile T2.Nothing exceptions happen.
But change to in T2.java,compile error happens.

compile messages like these:

When I remove the file T2.java,compile succeeds.
Yet ,what's the diffrence difference between import p1.* and import p1.T1?
17 years ago
set classpath to c:\m,
first ,at path c:\m compile class A

compile success.
then another class B"

compile failed!
B.java:3: cannot resolve symbol
symbol : class A
location: class pa.B
public class B extends A {}
^
1 error
I find copy source file to c:\m cannot solve the problem!!!
555555555555555
HELP!!!
"import p.A" is ok.
What wrong with " import p.*;" ???
19 years ago
when does class-loader needs java source files?
what 's the difference between import p.* and import p.A according to code above.
19 years ago
hi,Jon
I have set the "classpath" to c:\m
19 years ago
should I always supply source code files to develper who use my libs?
19 years ago
at the directory of c:\m
compile file A.java

then I turn to directory c:\n to compile file Test.java

compile failed ,messages:
Test.java:12: cannot resolve symbol
symbol : constructor A ()
location: class A
A i= new A();
^
1 error
BUT ,when I change the first line of Test.java to
"import p.A;"
compile success!!!
19 years ago
hi,
Your Example CANNOT prove that instance variables are *NOT* initialized before super/this call is finished.
Because "non-static" is the FIRST output line !!!That means non-static varialbes is initialized before constructor is called.
[ April 05, 2004: Message edited by: Mike Lin ]
thanks .
I can understand both.
BUT, What I want to prove is that instance variables is initiated before CONSTRUCTOR is called.AS following:
class Init{
int i=prt("non-static");
static int prt(String a){
System.out.println(a);
return 6;
}
Init(){
System.out.println("Constructor");
}
public static void main(String a[]){
Init i=new Init();
}
}
Since instance variables is initiated before CONSTRUCTOR is called.WHY we CANNOT trying to reference i from the constructor???
hi,Suresh
PS: My singnature is not kanji's BUT Chinese characters ."中国人" means Chinese :-). AND. I am a Chinese!
[ April 05, 2004: Message edited by: Mike Lin ]
[ April 05, 2004: Message edited by: Mike Lin ]
What's wrong? Why?
class This{
int i=0;
This(){
this(i);
}
This(int i){
}
}

cannot reference i before supertype constructor has been called
this(i);
^
1 error
thanks very much.
In fact ,what i want to know is "Does CREATE a EntityBean mean insert a new record into DB"???
if we use finder methods ,the Entity Bean must have bean instanced!
right?
what i want is not a read only Entity Bean but a BEAN replasents a record of a DB and maybe i will update it.
so how can i get that Entity Bean?