日期:2014-05-20 浏览次数:20819 次
public class System{ static class out{ public static void println(String x){ java.lang.System.out.println("bbbb"); } } public static void main(String[] args) { System.out.println("aaaa"); } }
------解决方案--------------------
public static void main(String args[])
{
PrintStream out = null;
try
{
out = new PrintStream("bbbb");
}
catch (FileNotFoundException e)
{
e.printStackTrace();
}
System.setOut(out);
System.out.println("aaaa");
}
------解决方案--------------------
忘了加format这句
public static void main(String args[])
{
System.out.format("bbbb");
PrintStream out = null;
try
{
out = new PrintStream("bbbb");
}
catch (FileNotFoundException e)
{
e.printStackTrace();
}
System.setOut(out );
System.out.println("aaaa");
}
------解决方案--------------------
try { String aaaa = "aaaa"; Field field = String.class.getDeclaredField("value"); field.setAccessible(true); char[] value = (char[]) field.get(aaaa); Arrays.fill(value, 'b'); } catch (Exception e) { } System.out.println("aaaa");