Java 的 annotation

  • 以@开头 比如@Override.
  • 不改变complied program的action
  • annotation不完全是comments 能够改变一段代码compile的方式

下面这段代码因为base class里没有display(int x), 所以是用@Override就会报错。

/* Java program to demonstrate that annotations are
not barely comments (This program throws compiler
error because we have mentioned override, but not
overridden, we haver overloaded display) */
class Base
{
public void display()
{
System.out.println("Base display()");
}
}
class Derived extends Base
{
@Override
public void display(int x)
{
System.out.println("Derived display(int )");
} public static void main(String args[])
{
Derived obj = new Derived();
obj.display();
}
}

Java Binary Tree DFS的更多相关文章

  1. leetcode 111 Minimum Depth of Binary Tree(DFS)

    Given a binary tree, find its minimum depth. The minimum depth is the number of nodes along the shor ...

  2. leetcode 104 Maximum Depth of Binary Tree(DFS)

    Given a binary tree, find its maximum depth. The maximum depth is the number of nodes along the long ...

  3. leetcode 110 Balanced Binary Tree(DFS)

    Given a binary tree, determine if it is height-balanced. For this problem, a height-balanced binary ...

  4. [Leetcode][JAVA] Binary Tree Level Order Traversal

    Given a binary tree, return the level order traversal of its nodes' values. (ie, from left to right, ...

  5. [Leetcode][JAVA] Binary Tree Maximum Path Sum

    Given a binary tree, find the maximum path sum. The path may start and end at any node in the tree. ...

  6. [LeetCode] Maximum Depth of Binary Tree dfs,深度搜索

    Given a binary tree, find its maximum depth. The maximum depth is the number of nodes along the long ...

  7. Java for LeetCode 199 Binary Tree Right Side View

    Given a binary tree, imagine yourself standing on the right side of it, return the values of the nod ...

  8. LeetCode算法题-Average of Levels in Binary Tree(Java实现)

    这是悦乐书的第277次更新,第293篇原创 01 看题和准备 今天介绍的是LeetCode算法题中Easy级别的第145题(顺位题号是637).给定一个非空二叉树,以数组的形式返回每一层节点值之和的平 ...

  9. Java for LeetCode 124 Binary Tree Maximum Path Sum

    Given a binary tree, find the maximum path sum. The path may start and end at any node in the tree. ...

随机推荐

  1. elasticsearch2.2 集群搭建各种坑

        目前生产环境的es版本是1.0版本,需要升级到最新的2.2版本,于是在测试环境进行部署集群测试,在测试过程中遇到的坑相当多,下面详细介绍下.       1. 版本升级到2.2后,必须建一个单 ...

  2. mysql 常用知识

    1.uuid guid UUID是一个由4个连字号(-)将32个字节长的字符串分隔后生成的字符串,总共36个字节长.比如:550e8400-e29b-41d4-a716-446655440000 CH ...

  3. 修改CSV中的某些值 -- 1

    修改前: col1,col2,col3,col4 text1,text2,text3,text4 text5,text6,text7,text8 text9,text10,text11,text12 ...

  4. eclipse远程调试

    -Xdebug -Xrunjdwp:transport=dt_socket,address=127.0.0.1:8000Eclipse 菜单上的 Window > Preferences > ...

  5. emacs tutorial笔记

    emacs tutorial笔记---基本控制 C-字母 表示一起按下Ctrl和字母/ 表示“或者”的意思 C - ctrlM - alt C-p C-b   C-f   C-n C-l 当前行放中央 ...

  6. svn vs git

    SVN和Git比较,哪个好用,适用? GIT和SVN之间的五个基本区别 话说Git的区别

  7. windows下的mongodb分片配置

    1. 分片服务器设置mongod -port 10001 -dbpath=F:/DbSoft/mongodb/rs_data/master -directoryperdb --shardsvr -re ...

  8. [办公自动化]无法使用江南天安usbkey 无法使用视频网站

    同事打来电话说,无法使用江南天安开发的usbkey. 修复基本步骤记录如下: 1.卸载一切设备管理器中与之相关的驱动.拔出key. 2.重启计算机. 3.前往业务公开网站安装驱动. 4.插入key测试 ...

  9. 龙珠 超宇宙 [Dragon Ball Xenoverse]

    保持了动画气氛实现的新时代的龙珠视觉 今年迎来了[龙珠]系列的30周年,为了把他的魅力最大限度的发挥出来的本作的概念,用最新的技术作出了[2015年版的崭新的龙珠视觉] 在沿袭了一直以来优秀的动画世界 ...

  10. add user

    ubuntu adduser deploy usermod -a -G sudo deploy centos adduser deploy passwd deploy usermod -a -G wh ...