Code Monkey home page Code Monkey logo

javase11's Introduction

Java

Implicit narrowing(for final constant) occurs only for byte, char, short, and int. Remember that it does not occur for long, float, or double.

Inner class

Method-local inner classes cannot be defined using explicit access modifiers (public, protected and private) but non-access modifiers: final and abstract can be used with method-local inner class. Static also not allowed.

a method local inner class can access local variables and parameters of the enclosing block that are final or effectively final.

Collection

  • The of and copyOf methods do not support null elements.

Exception

  • The class Exception and any subclasses that are not also subclasses of RuntimeException are checked exceptions. Checked exceptions need to be declared in a method or constructor's throws clause if they can be thrown by the execution of the method or constructor and propagate outside the method or constructor boundary.

  • java.lang.Exception is a checked Exception

Interface

  • Though an interface is allowed to have overriding abstract methods [equals(Object) method, toString() method etc.] from Object class but default methods of an interface cannot override the methods of the Object class.
  • Interfaces in java are allowed to override default method with abstract method and vice versa.
  • An Interface can extend an interface and override the abstract method with default interface.
  • a default method cannot be overridden by a static method.
    • cannot override a non-static method with a static method and vice versa in a class.
    • static methods are never overridden, they may be hidden by a "static method of a subclass" with the same signature.
  • You can, however, redeclare a static method of a super interface as a default method in the sub interface
    • because a static method of an interface can only be called using that interface's name.
      • (note: static methods cannot be overridden by an instance method).
      • because "A class cannot have two methods with the same signature in its scope where one is static and one is instance."

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.