当前位置: 代码迷 >> Android >> import java.io.File;出错?解决办法
  详细解决方案

import java.io.File;出错?解决办法

热度:21   发布时间:2016-05-01 21:37:10.0
import java.io.File;出错?
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
------解决方案--------------------
值得同情呀
  相关解决方案