Bootstrap

JAVA在编写内部类时No enclosing instance of type XXX is accessible. Must qualify原因及解决

错误信息如下:

No enclosing instance of type Analysis_IDCard is accessible. Must qualify the allocation with an enclosing instance of type Analysis_IDCard (e.g. x.new A() where x is an instance of Analysis_IDCard).

导致的原因为:

package AnalysisNo;

import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Scanner;

public class Analysis_IDCard {
	
	public  class IdInformation{
	   public  String idnumber;  
	   public  String birthday;
	   public  String sex;
	   
	   public IdInformation(String idnumber,String birthday,String sex)
	   {
		   this.birthday=birthday;
		   this.idnumber=idnumber;
		   this.sex=sex;
	   }
	    public String getbirthday() {
	        return birthday;
	    }

	    public String getidnumber() {
	        return idnumber;
	    }

	    public String getsex() {
	        return sex;
	    }

	}
	

在main方法中

;