• Think in Java


    Java also has a “default” access, which comes into play if you don’t use one of the aforementioned specifiers. This is usually called package access because classes can access the members of other classes in the same package (library component), but outside of the package those same members appear to be private.

    The “wrapper” classes for the primitive data types allow you to make a non-primitive object on the heap to represent that primitive type.

    java.lang is implicitly included in every Java code file

    constructor 内部可能通过this 调用其它construcotr,但在成员函数内不能用this调用constructor

    finalize()在什么时候被调用?有三种情况
    1.所有对象被Garbage Collection时自动调用,比如运行System.gc()的时候.
    2.程序退出时为每个对象调用一次finalize方法。
    3.显式的调用finalize方法
    除此以外,正常情况下,当某个对象被系统收集为无用信息的时候,finalize()将被自动调用,但是jvm不保证finalize()一定被调用,也就是说,finalize()的调用是不确定的,这也就是为什么sun不提倡使用finalize()的原因

    because they are in the same directory and have no explicit package name. Java treats files like this as implicitly part of the “default package” for that directory, and thus they provide package access to all the other files in that directory.

    protected also gives package access—that is, other classes in the same package may access protected elements

    The actual process of initialization is:
    1.The storage allocated for the object is initialized to binary zero before anything else happens.
    2.The base-class constructors are called as described previously. At this point, the overridden draw( ) method is called (yes, before the RoundGlyph constructor is called), which discovers a radius value of zero, due to Step 1.
    3.Member initializers are called in the order of declaration.
    4.The body of the derived-class constructor is called.

    @Override

    When you mean to override a method, you can choose to add this annotation and the compiler will produce an error message if you accidentally overload instead of overriding

  • 相关阅读:
    DELPHI中Showmodal与Show的区别
    怎样把一个文件夹里面所有文件的文件名提取出来,放到Excel表格里呢
    Python基础之函数
    Python_Openpyxl
    设计模式
    【转】深入理解递归函数的调用过程
    Java集合的Stack、Queue、Map的遍历
    数据结构-String、char
    leetcode-位运算
    Java web入门
  • 原文地址:https://www.cnblogs.com/lgxqf/p/1590964.html
Copyright © 2020-2023  润新知