主题:救命啊~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
缺乏类的主方法,应该怎么改!拜托~~~后天要交了。请帮我添加完整的主方法,谢谢!下面2题都是这样的错法!
第一题:
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package c;
/**
*
* @author Administrator
*/
public class C {
/**
* @param args the command line arguments
*/
int p;
// TODO code application logic here
public void main(String[] args) {
setP(p);
}
public void setP(int p){
this.p=p;
}
}
错误提示:缺乏类的主方法。
第二题:
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package mytime;
/**
*
* @author Administrator
*/
public class MyTime {
/**
* @param args the command line arguments
*/
private int hour,minute,second;
public MyTime() {setTime(0,0,0);}
public MyTime(int h,int m,int s){ setTime(h,m,s);}
public void setTime(int h,int m, int s){
hour = (h>=0 && h<=25) ? h : 0;
minute = (m>=0 && m<=59) ? m : 0;
second = (s>=0 && s<=59) ? s : 0;
}
public void incSecond(){
second++;
if(second==60){
second=0; minute++;
if(minute==60){
minute=0; hour++;
if(hour==24) hour=0;
}
}
}
public void show() {
System.out.println(hour+"-"+minute+"-"+second);
}
}
提示:缺乏类的主方法
急切地等待ing~~~~~~~~~~~~~~~~~
第一题:
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package c;
/**
*
* @author Administrator
*/
public class C {
/**
* @param args the command line arguments
*/
int p;
// TODO code application logic here
public void main(String[] args) {
setP(p);
}
public void setP(int p){
this.p=p;
}
}
错误提示:缺乏类的主方法。
第二题:
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package mytime;
/**
*
* @author Administrator
*/
public class MyTime {
/**
* @param args the command line arguments
*/
private int hour,minute,second;
public MyTime() {setTime(0,0,0);}
public MyTime(int h,int m,int s){ setTime(h,m,s);}
public void setTime(int h,int m, int s){
hour = (h>=0 && h<=25) ? h : 0;
minute = (m>=0 && m<=59) ? m : 0;
second = (s>=0 && s<=59) ? s : 0;
}
public void incSecond(){
second++;
if(second==60){
second=0; minute++;
if(minute==60){
minute=0; hour++;
if(hour==24) hour=0;
}
}
}
public void show() {
System.out.println(hour+"-"+minute+"-"+second);
}
}
提示:缺乏类的主方法
急切地等待ing~~~~~~~~~~~~~~~~~