由买买提看人间百态

boards

本页内容为未名空间相应帖子的节选和存档,一周内的贴子最多显示50字,超过一周显示500字 访问原贴
Java版 - 问一简单的问题 关于import
相关主题
Re: Put classes into different filesmultiple classes in one file:revisted
How to import a class?Re: [转载] Re: .jar文件是怎么产生的?
[转载] 这个是什么错误呀?Re: help: how does the class Model$5.class come?
get full class nameRe: java class decompile
新手问一个:如何找.jar文件里都有什么class?Cryptoquivalence Classes
How to use classes in a jar file?Re: where can I DL these 2 books
折腾了一天,实在是绝望了,请教请教help: interface and class
Jar questiongive different classes involved in a jav
相关话题的讨论汇总
话题: date话题: class话题: import话题: explicitly话题: name
进入Java版参与讨论
1 (共1页)
t******l
发帖数: 6
1
我在书上看到,假如 there are classes with the same name in tow different
package, and then you must either making one or the other calss explicitly, or
you must refer to the class using its fully qualified name.
那我想请问,比如说有一个小程序,都使用 Date class in package java.util and
java.sql
import java.util.Date;
import java.sql.Date;
public class Test
{
Date myDate = new Date();
}
那么这个Date class 到底是谁的? 或者说如果我想说明它是java.util.Date应该怎么板

我这个问题比较STUPID,今天看书的时候突然想到的,也许根本没有人这么写程序吧
谢谢!
s*a
发帖数: 6
2
you need to use full class name here.
java.sql.Date my Date = new java.sql.Date();

or


【在 t******l 的大作中提到】
: 我在书上看到,假如 there are classes with the same name in tow different
: package, and then you must either making one or the other calss explicitly, or
: you must refer to the class using its fully qualified name.
: 那我想请问,比如说有一个小程序,都使用 Date class in package java.util and
: java.sql
: import java.util.Date;
: import java.sql.Date;
: public class Test
: {
: Date myDate = new Date();

t******l
发帖数: 6
3
oh i c lah..
thank you very much!

explicitly,


【在 s*a 的大作中提到】
: you need to use full class name here.
: java.sql.Date my Date = new java.sql.Date();
:
: or
: 板

s****d
发帖数: 13
4
hehe, actually best way is try to compile your java class to see what will
happen.
that will give u deeper impression. :)

and



【在 t******l 的大作中提到】
: oh i c lah..
: thank you very much!
:
: explicitly,
: 么

s*a
发帖数: 6
5
yes, it is the best way to learn a language, i think.

different



【在 s****d 的大作中提到】
: hehe, actually best way is try to compile your java class to see what will
: happen.
: that will give u deeper impression. :)
:
: and
: 怎
: 吧

a****a
发帖数: 112
6
nod nod, failure is the mom of success. :P
After being tortured by compiler N times, you know how to write
your programs right.

【在 s*a 的大作中提到】
: yes, it is the best way to learn a language, i think.
:
: different
: 该
: 序

N***m
发帖数: 4460
7
eclipse will let you choose which version.

, or

【在 t******l 的大作中提到】
: 我在书上看到,假如 there are classes with the same name in tow different
: package, and then you must either making one or the other calss explicitly, or
: you must refer to the class using its fully qualified name.
: 那我想请问,比如说有一个小程序,都使用 Date class in package java.util and
: java.sql
: import java.util.Date;
: import java.sql.Date;
: public class Test
: {
: Date myDate = new Date();

e********3
发帖数: 18578
8
not when both Date classes are referred in the same class, you need to use
the full path explicitly in that scenario.

【在 N***m 的大作中提到】
: eclipse will let you choose which version.
:
: , or

1 (共1页)
进入Java版参与讨论
相关主题
give different classes involved in a jav新手问一个:如何找.jar文件里都有什么class?
如何获得类定义的public methods?How to use classes in a jar file?
[转载] Urgent Help needed about Java Servlet?折腾了一天,实在是绝望了,请教请教
●●●●紧急求助JAVA初级问题,今天project due●●●●Jar question
Re: Put classes into different filesmultiple classes in one file:revisted
How to import a class?Re: [转载] Re: .jar文件是怎么产生的?
[转载] 这个是什么错误呀?Re: help: how does the class Model$5.class come?
get full class nameRe: java class decompile
相关话题的讨论汇总
话题: date话题: class话题: import话题: explicitly话题: name