- Java code
package com.example.android.apis;import android.app.Activity;import android.os.Bundle;import android.os.Environment;import android.view.Menu;import java.io.File; //出错!!!The import java.io.File conflicts with a type defined in the same fileimport java.io.IOException;public class File extends Activity { String sdPath,Mondays,Tuesdays,Wednesdays,Thursdays,Fridays; @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); sdPath=Environment.getExternalStorageDirectory().getAbsolutePath(); //获得SD卡路径 String path=sdPath+"/Schedule"; //创建文件夹对象 Mondays = path+"/Monday.txt"; Tuesdays = path+"/Tuesday.txt"; Wednesdays = path+"/Wednesday.txt"; Thursdays = path+"/Thursday.txt"; Fridays = path+"/Friday.txt"; File Monday = new File(Mondays);//出错!!!The constructor File(String) is undefined }
为啥出错呢?求解。。。
------解决方案--------------------
类命名成File
------解决方案--------------------
值得同情呀