Java??????????????????
?????Darker ???????[ 2016/7/6 15:13:41 ] ??????????????????? Java
??????????:
????1.?????
????2.????
????1.?????
????????????Java???????????????..?????????????????????????????????????????????????????.???????????????????????.
????i.????????????.
?????????????£?????????????????.
?????????????????????????????????????????????????????????????.???????????????????????????????????????????????????????????????????????????????????.?????????????????????.????????????????????????????????????????????????????????????????????????(??????????).
class Darker{
private String darker;
public Darker() {
// TODO Auto-generated constructor stub
System.out.println("Default Constructor: "+darker);
}
public Darker(String darker){
this.darker = darker;
System.out.println("Overload Constructor: "+darker);
}
}
public class Main {
public static void main(String[] args) {
// TODO Auto-generated method stub
Darker darker = new Darker();
Darker darker2 = new Darker("darker");
}
}
????????????????????.????????????ò??????????????г????.???????????.Java?????????????????????????????????????????????????????????????????????????????????.???????????????????????ò?????????.?????????????????????.
????ii.????????.
???????????????????ι??????????????????????????.??????????????ж??????????????????????????????????????????????????.???????.??????д???class????????????д???????????????????????????????????.
class Darker{
public String getDarker() {
return darker;
}
public void setDarker(String darker) {
this.darker = darker;
}
private String darker;
}
public class Main {
public static void main(String[] args) {
// TODO Auto-generated method stub
Darker darker = new Darker();
darker.setDarker("darker");
System.out.println(darker.getDarker());
}
}
/**
*OutPut
*darker
*/
??????????????????????????????????????????????????????????κ??????.?????????????????????????????????.?????????????????..
package com.thinking.in.java;
class Darker{
private String darker;
public Darker(String darker){
this.darker = darker;
}
// public Darker(){
//
// }
public String getDarker() {
return darker;
}
public void setDarker(String darker) {
this.darker = darker;
}
}
public class Main {
public static void main(String[] args) {
// TODO Auto-generated method stub
Darker darker = new Darker();
darker.setDarker("darker");
System.out.println(darker.getDarker());
}
}
?????????????????????????????????????????вι?????.??????????????????壬???????????????ι?????????????????.Darker darker = new Darker(); ??仰????????????.?????? The constructor Darker() is undefined .??????????ι???????ж???.??????????????????????????Java?????.?????????????д?κ???????????????Java?????????????????????????????????????????????.?????????????????????????(???:?вι?????).???Java??????:?????????????????????????????????????????.?????????????????.????Java??????????????????????.?????????вΣ????????????????????????????????? Darker darker = new Darker()??仰?????????.
??????
???·???
??????????????????
2023/3/23 14:23:39???д?ò??????????
2023/3/22 16:17:39????????????????????Щ??
2022/6/14 16:14:27??????????????????????????
2021/10/18 15:37:44???????????????
2021/9/17 15:19:29???·???????·
2021/9/14 15:42:25?????????????
2021/5/28 17:25:47??????APP??????????
2021/5/8 17:01:11