Can anyone explain me,
public class Class10 {
public String i=" ";
public String j;
j=" "; //Does-Not work
public void method(String[] args){
public String k=" "; // Does-not work
j=" ";
}
}
1) It is possible with the right syntax (but discouraged) :
public class Class10 {
public String i=" ";
public String j;
{j=" ";} //This is called an "Instance initialization block"
//It would be better to do it in a constructor.
2) It does not make sense :
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.