public class SquareInt { public static void main(String[] args) { int result; ; x <= ; x++) { result = square(x); // Math库中也提供了求平方数的方法 // result=(int)Math.pow(x,2); System.out.println("The square of " + x + " is " + result + "\…
1 面向对象简述 将 {1,3,45,56,78,90}转化为[1,3,45,56,78,90] 1-2 方法1:面向过程 代码块 public class test { public static void main(String[] args) { int[] array = {1,3,45,56,78,90}; // 打印成[1,3,45,56,78,90] System.out.print("["); for (int i = 0; i < array.length; i…
1.请运行以下示例代码StringPool.java,查看其输出结果.如何解释这样的输出结果?从中你能总结出什么? true true false 总结: 使用new关键字创建字符串对象时, 每次申请新开辟一个地址空间,存储的地址空间不一样(对象不同),string类型下hello是同一个对象,其内容和地址都相容. 2. public class StringEquals { /** * @param args the command line arguments */ public stati…