zoukankan      html  css  js  c++  java
  • String面试题


    //a b c 分别是怎么存储的, a和b a和c分别有什么区别
    // c和d的区别是什么


    String a= "hello";
    String b= "hello"+"world";
    String c= new String("hello");
    String d= new String("hello")+new String("world");
    //System.out.println(c);

    System.out.println(c); 
    在被注释的时候c就没有定义了,d还是会有定义,这是为什么呢
    String a = "hello";
    String b = "helloworld";
    new String("hello");
    String d = new String("hello") + new String("world");
    ===
    String a= "hello";
    String b= "hello"+"world";
    String c= new String("hello");
    String d= new String("hello")+new String("world");
    System.out.println(c);
    
    
    String a = "hello";
    String b = "helloworld";
    String c = new String("hello");
    String d = new String("hello") + new String("world");
    System.out.println(c);

    ====
    String a;
    System.out.print(a);

    err:
    未初始化的参数 a

    常量池在java用于保存在编译期已确定的,已编译的class文件中的一份数据。它包括了关于类,方法,接口等中的常量,也包括字符串常量,如String s = "java"这种申明方式;当然也可扩充,执行器产生的常量也会放入常量池,故认为常量池是JVM的一块特殊的内存空间。

     jstat,jmap,jstack

     2015/9/24 11:42:46

    我一般用jstat -gc -gcutil比较多

     2015/9/24 11:42:51

    看堆内存的占用情况

     2015/9/24 11:43:07

    看string这种,可以看字节码 
  • 相关阅读:
    Linux 文件隐藏属性-创建文件默认权限
    Linux 文件权限管理
    Linux 用户管理_用户相关配置文件详解
    Linux 压缩包管理
    vim 编辑器高级用法
    Linux ll查看文件属性详解-软硬链接详解
    安卓学习28
    安卓学习27
    安卓学习26
    安卓学习25
  • 原文地址:https://www.cnblogs.com/viewcozy/p/4832971.html
Copyright © 2011-2022 走看看