如何在实例化时输入格里历日历参数? [英] How to enter gregorian calendar parametrs when instanciating ?
本文介绍了如何在实例化时输入格里历日历参数?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
问候,
如何在我的主方法中实现格里高利历的参数?
我有这个构造函数:
public Personne( String leNom, String lePrenom,GregorianCalendar laDate,Adresse lAdresse){
nom = leNom.toUpperCase();
prenom = lePrenom;
dateNaissance = laDate;
adresse = lAdresse;
nb_instance ++;
}
所以我想通过从main实例化来测试对象:
< pre lang =java> public class test {
public static void main(字符串 [] args {
Personne personne1 = new Personne( Voronitski,Viktor,1986,Calendar.FEBRUARY,25, Slavinskogo );
}
}
编译器说实际参数的长度不同。
解决方案
Personne personne1 = new Personne(Voronitski ,Viktor,1986,Calendar.FEBRUARY,25,Slavinskogo);
^ ^ ^ -------------------------
0)你错过了一些引用
1)你提供了日期的三个部分,而不是日期。
Greetings ,
How to instanciate the Gregorian calendar parametrs in my main method ?
I have this constructor :
public Personne(String leNom,String lePrenom, GregorianCalendar laDate, Adresse lAdresse){
nom = leNom.toUpperCase();
prenom=lePrenom;
dateNaissance=laDate;
adresse=lAdresse;
nb_instance ++;
}
So i want to test the object by instanciating it from main :
public class test {
public static void main(String [] args{
Personne personne1 = new Personne("Voronitski,Viktor,1986,Calendar.FEBRUARY,25,"Slavinskogo");
}
}
The compiler is saying that actual parametrs differs in lenght.
解决方案
Personne personne1 = new Personne("Voronitski","Viktor",1986,Calendar.FEBRUARY,25,"Slavinskogo"); ^ ^ ^ -------------------------
0) You're missing some quotes
1) You provide three parts of a date, not a date.
这篇关于如何在实例化时输入格里历日历参数?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文