你说的是JAVA里的吧
应该指向堆怎么题目要求学过C++的来解答?

解决方案 »

  1.   

    Java里没有指针这个概念的。
    另外,你要问什么?
      

  2.   

    只要是new出来的就都是分配在堆区的,而非new出来的在c++中一般是放在栈区或全局数据区。
      

  3.   

    指向String这个字符串的第一个字母h所在的地址。
      

  4.   

    String str=new String("hello");  // 错的,老大new is for allocating space for pointerstring is not a pointer
    in java, everything is object, haha 
    这是C++, 不是java
      

  5.   

    String str=new String("hello");  // 错的,老大
    你怎么知道是错的?
      

  6.   

    new String("hello")分配到堆
    "hello"分配到栈无论new String("hello")还是"hello"都是在内存中创建一个类。
    只不过,"hello"是一个static final class.String str=new String("hello");  //Java是不建议这么做的。