Java中用自己的包的小问题?? 不会吧!将你的包所在的文件夹路径添加到CLASSPATH中再编译试试!譬如:ConsoleReader包在d:\mypackage下,就将d:\mypackage添加到CLASSPATH中! 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 包的使用代码package ConsoleReader;public class arrayConversiontemp{ private int[][] _data = null; public arrayConversiontemp(int[][] data) { this._data = data;//构造函数,传递数组 } public String getFormatStr() { if (_data==null||_data.length==0||this._data[0].length==0) { return null;//如果数组为空 } int rowCount= this._data.length;//获取行数 int colCount= this._data[0].length;//获取列数 //定义返回字符串 String output = "The Data of two dimensional array:\n"; for (int i=0;i<rowCount ;i++ ) { //输出原始二维数组 for (int j=0;j<colCount ;j++ ) { if ( j == 0 && i == 0 ) output += "┏"; if ( j == 0 && i == rowCount-1 ) output += "┗"; if ( j == 0 && i != 0 && i != rowCount-1) output += "┃"; //二维数组的输出 output += " "+_data[i][j]+" "; if ( j == colCount-1 && i != 0 && i != rowCount-1) output += "┃"; if ( j == colCount-1 && i == 0 ) output += "┓"; if ( j == colCount-1 && i == rowCount-1 ) output += "┛"; } output += "\n"; } return output;} /* public static void main(String[] args) { //预设 5 * 4 的矩阵数据 int[][] Data = { {9, 7, 6, 6}, {9, 7, 6, 6}, {3, 5, 3, 3}, {6, 6, 4, 7}, {7, 5, 1, 4}, {1, 2, 8, 0} }; arrayConversiontemp temp = new arrayConversiontemp(Data); System.out.println(temp.getFormatStr()); }*/} 为什么这段代码会输出10个17?我觉得每次list都添加进去了啊?怎么最后都被替换了? 排名问题 求助!! java中内部类和嵌套类有什么区别? 问一个弱弱的问题。。。。。。。。。。。。。。 几个名词翻译----急用! 怎样传送若干条信息?期待ing... 有没有比较好的java mail list,推荐一下呗 jbuilder问题,up有分!!! java中 unicode编码问题 讨论:Java学习方向 很急!!!!!
{
private int[][] _data = null;
public arrayConversiontemp(int[][] data)
{
this._data = data;//构造函数,传递数组
} public String getFormatStr()
{ if (_data==null||_data.length==0||this._data[0].length==0)
{
return null;//如果数组为空
} int rowCount= this._data.length;//获取行数
int colCount= this._data[0].length;//获取列数
//定义返回字符串
String output = "The Data of two dimensional array:\n";
for (int i=0;i<rowCount ;i++ )
{ //输出原始二维数组
for (int j=0;j<colCount ;j++ )
{
if ( j == 0 && i == 0 )
output += "┏";
if ( j == 0 && i == rowCount-1 )
output += "┗";
if ( j == 0 && i != 0 && i != rowCount-1)
output += "┃";
//二维数组的输出
output += " "+_data[i][j]+" "; if ( j == colCount-1 && i != 0 && i != rowCount-1)
output += "┃";
if ( j == colCount-1 && i == 0 )
output += "┓";
if ( j == colCount-1 && i == rowCount-1 )
output += "┛";
}
output += "\n";
}
return output;
}
/*
public static void main(String[] args)
{
//预设 5 * 4 的矩阵数据
int[][] Data =
{ {9, 7, 6, 6},
{9, 7, 6, 6},
{3, 5, 3, 3},
{6, 6, 4, 7},
{7, 5, 1, 4},
{1, 2, 8, 0}
}; arrayConversiontemp temp = new arrayConversiontemp(Data);
System.out.println(temp.getFormatStr()); }
*/
}