1.
public static void main (String []args){
        Student stu =new Student();
        stu=new Student();

请问内存中有几个  Student()
2.
前辈们在开发中,你们公司是否提供静态页面。

解决方案 »

  1.   

    请问内存中有几个  Student() ?
    应该是内存中有几个Student对象
    2个,每次new Student()都会在堆中生成新的对象
      

  2.   

    1. 2个对象,原因很简单,因为new 了两次Student()。虽然第一个new以后,没有在程序中引用,但是java的垃圾回收站还没有及时的回收。
    2. 是否提供静态页面?做什么的?UI设计吗。这个需要;还是程序模板,这个看系统啦,网站多点
      

  3.   

    1个Student对象
    在引用指向第二个的时候  第一个已经被JVM回收了
      

  4.   


    public class hello {
      public int num = 0; 
      public static void main(String args[]) {
     
     hello h = new hello();
     h.num = 1;
     hello h1 = h;
         System.out.println(h1.num);
         System.out.println(h.num);//返回1  1   说明h,h1是两个指针都指向第一个实例
         
         h = new hello();
         System.out.println(h1.num);
         System.out.println(h.num);//返回1  0   说明h,h1分别是两个指针的实例
      }
    } ///至于第一个实例有没有被收回,这个我就不知道了
      

  5.   

    JVM什么时候回收的我们并不知道的
    2个对象 new了2个
      

  6.   

    1. 两个对象, 
    public static void main (String []args){ 
            Student stu =new Student();
    // Student stu 仅仅是在 栈上面定义了一个变量,其不具备任何值
    //Student stu = new Student() 将这个对象的实例的引用给了 stu 这个变量; 
            stu=new Student(); 
    // stu 变量被重新引用另外一个在堆上创建的 Student 对象实例;
    } 2. 静态页面是需求, 需要你将其改成 JSP 等等页面,这才是结果
      

  7.   

    第一题:应该有2个Student的对象stu
    第二题:那要看贵公司开发的什么样的系统