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这种,可以看字节码 
  • 相关阅读:
    [ 字典树题目 ]
    AC Challenge [ ACM-ICPC 2018 南京赛区网络预赛 ] [dfs + 二进制记忆化搜索 ]
    ACM-ICPC 2018 南京赛区网络预赛 J.Sum [ 类打表 ]
    Bzoj 3224.普通平衡树 [ 权值线段树 ]
    IP:网际协议
    网络概述
    HashSet
    idea中git各颜色文件含义
    keytool证书管理
    openssl证书管理
  • 原文地址:https://www.cnblogs.com/viewcozy/p/4832971.html
Copyright © 2011-2022 走看看