Java 基础

关于 static final method 的疑惑

前言 在声明一个方法为 static final 时,IDEA 给出了一个 warning: When a static method is overriden in a subclass it can still be accessed via the superclass making the final declaration not very necessary. Declaring a static method final does prevent subclasses from defining a static method with the

Java 容器学习之 HashMap

一、HashMap简介 看一下官方文档中对HashMap的描述 * Hash table based implementation of the <tt>Map</tt> interface. This * implementation provides all of the optional map operations, and permits * <tt>null</tt> values and the <tt>null</tt> key. (The <tt>HashMap</tt> * class is roughly equivalent to <tt>Hashtable</tt>, except that it

关于 try 和 finally 中的 return

关于 try 和 finally 中的 return 首先我们来看一段代码: public class Test { public static int inc() { int x = 1; try { return ++x; // 1* } catch (Exception e) { } finally { x++; } return x; } public static void main(String[] args) { System.out.println(inc()); } } 它的输出结果是多少呢