再来一段挑战C#高手的JAVA代码?用C#能写出优雅的JAVA结构来吗? 感觉是可以写出来, 但有些乱.public interface FieldCache { public static final int STRING_INDEX = -1; public static class StringIndex { /** All the term values, in natural order. */
public final String[] lookup; /** For each document, an index into the lookup array. */
public final int[] order; /** Creates one of these objects */
public StringIndex (int[] values, String[] lookup) {
this.order = values;
this.lookup = lookup;
}
}}
public final String[] lookup; /** For each document, an index into the lookup array. */
public final int[] order; /** Creates one of these objects */
public StringIndex (int[] values, String[] lookup) {
this.order = values;
this.lookup = lookup;
}
}}
两种语言看起来很像但是在很多机制的处理上是有区别的,如果用写java的方式来写C#那是榆木脑袋的做法。
反问楼主一句
string[] strArray=new string[]{"楼","主","不","摆","了"};
foreach(string str in strArray)
{
Console.WriteLine(str);
}
这个东西在java里面你能写得出来?
Runtime.getRuntime().freeMemory()JAVA程序员可以很容易获得还有多少FREE内存, 但是C#似呼就没有了, 还得调用API函数, 真是麻烦啊.