zoukankan      html  css  js  c++  java
  • Java Class/Method

    • A class can have only public or default(no modifier) access specifier.
    • It can be either abstract, final or concrete (normal class).
    • It must have the class keyword, and class must be followed by a legal identifier.
    • It may optionally extend one parent class. By default, it will extend java.lang.Object.
    • It may optionally implement any number of comma-separated interfaces.
    • The class's variables and methods are declared within a set of curly braces {}.
    • Each .java source file may contain only one public class. A source file may contain any number of default visible classes.
    • Finally, the source file name must match the public class name and it must have a .java suffix.

     How a class is initialized in java

    class is initialized in Java when an instance of class is created using either new operator or using reflection using

    class.forName(). A class is also said to be initialized when a static method of Class is invoked or a static filed is assigned

     How to make a copy of an entire Java object with its state

    Make that class implement Cloneable interface and call clone() method on its object.clone() method is defined in Object class which is the parent of all java class by default.

    Java Method:

    In java when you pass a primitive type to a method it is pass by value

    when you pass an object of any type to a method it is passed as reference

  • 相关阅读:
    python环境的安装 环境变量和系统变量
    git语句(后续补充)
    pycharm的安装配置及思维导图
    python基础知识 01
    C#基础系列——异步编程初探:async和await
    Type.MakeGenericType 方法 (Type[]) 泛型反射
    ZeroFormatter
    intelliJ IDEA相关
    truesky天气系统
    tressfx hair
  • 原文地址:https://www.cnblogs.com/morningdew/p/5618525.html
Copyright © 2011-2022 走看看