如何将input date日期斜杠改成横线
1个回答
2015-05-26
展开全部
public class Date{
private int year,month,day;
public Date(){
}
public void input_Date(int year,int month,int day){
this.year = year;
this.month = month;
this.day = day;
}
public void output_Date(){
System.out.println("日期是:"+year+"年"+month+"月"+day+"日");
}
}
//测试类
public class Test{
public static void main(String args[]){
Date date = new Date();
Scanner input = new Scanner(System.in);
System.out.println("请输入年月日:");
int year = input.nextInt();
int month = input.nextInt();
int day = input.nextInt();
date.input_Date(year,month,day);
date.output_Date();
}
}
private int year,month,day;
public Date(){
}
public void input_Date(int year,int month,int day){
this.year = year;
this.month = month;
this.day = day;
}
public void output_Date(){
System.out.println("日期是:"+year+"年"+month+"月"+day+"日");
}
}
//测试类
public class Test{
public static void main(String args[]){
Date date = new Date();
Scanner input = new Scanner(System.in);
System.out.println("请输入年月日:");
int year = input.nextInt();
int month = input.nextInt();
int day = input.nextInt();
date.input_Date(year,month,day);
date.output_Date();
}
}
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询