AbstractMethodError:

This java.lang.AbstractMethodError is usually thrown when we try to invoke the abstract method.

we know that an abstract method cannot be invoked and if we try to do so then you will get a compile-time error.So you may think how this error is thrown at run-time?.

The reason is binary incompatibility-what does it mean?

     Whenever a class is modified,other classes that refer to this (modified) class will not be aware of the changes made in it.So all the classes must be compiled as a whole.If not then you may encounter one of the subclasses of incompatible class change error.

"This error indicates that the method that you invoke is converted into an abstract method now".

see the following example to have an idea about this error

class B

{

public void display()

{

System.out.println("I am inside B");

}

}

import java.util.*;

public class A extends B

{

public static void main(String args[])

{

A a=new A();

a.display();

}

}

output:

C:\blog>javac A.java

C:\blog>java A

I am inside B

Now i am going to convert the display() method as an abstract method and compile it alone.

abstract class B

{

public abstract void display();

}

Output:

C:\blog>javac A.java

C:\blog>java A

I am inside B

C:\blog>javac B.java

C:\blog>java A

Exception in thread "main" java.lang.AbstractMethodError: B.display()V

at A.display(A.java:3)

at A.main(A.java:8)

AbstractMethodError:的更多相关文章

  1. 疑惑的 java.lang.AbstractMethodError: org.mybatis.spring.transaction.SpringManagedTransaction.getTimeout()L

    在MAVEN项目里面,在整合spring和mybatis在执行数据库操作的时候报出了: java.lang.AbstractMethodError: org.mybatis.spring.transa ...

  2. 使用DBCP时发生AbstractMethodError异常

    使用DBCP时发生AbstractMethodError异常,错误描述: Exception in thread "main" java.lang.AbstractMethodEr ...

  3. 疑难杂症:java.lang.AbstractMethodError: org.apache.xerces.dom.DocumentImpl.setXmlVersion(Ljava/lang/String;)V

    错误: java.lang.AbstractMethodError: org.apache.xerces.dom.DocumentImpl.setXmlVersion(Ljava/lang/Strin ...

  4. HIbernate java.lang.AbstractMethodError: com.microsoft.jdbc.base.BaseDatabaseMetaData.supportsGetGeneratedKeys()Z

    [HIbernate]java.lang.AbstractMethodError: com.microsoft.jdbc.base.BaseDatabaseMetaData.supportsGetGe ...

  5. AbstractMethodError using UriBuilder on JAX-RS

    问题描述:Eclipse调试JAX-RS服务没问题,但是在发布服务端时候抛出异常 java.lang.AbstractMethodError: javax.ws.rs.core.UriBuilder. ...

  6. java.lang.AbstractMethodError: org.mybatis.spring.transaction.SpringManagedTransaction.getTimeout()Ljava/lang/Integer; at org.apache.ibatis.executor.SimpleExecutor.prepareStatement(SimpleExecutor.jav

    在整合spring和mybatis在执行数据库操作的时候报出了: java.lang.AbstractMethodError: org.mybatis.spring.transaction.Sprin ...

  7. Spark踩坑——java.lang.AbstractMethodError

    今天新开发的Structured streaming部署到集群时,总是报这个错: SLF4J: Class path contains multiple SLF4J bindings. SLF4J: ...

  8. QA:Initialization of bean failed; nested exception is java.lang.AbstractMethodError

    Q: <hibernate.version>5.2.10.Final</hibernate.version><dependency> <groupId> ...

  9. java.lang.AbstractMethodError: org.mybatis.spring.transaction.SpringManagedTransaction.getTimeout()L

    mybatis与springboot集成的时候,报错:java.lang.AbstractMethodError: org.mybatis.spring.transaction.SpringManag ...

随机推荐

  1. jQuery 获取不到 kindeditor 内容 的解决方法

    错误写法 :  var content = $('#Content').val(); 正确写法: var content = $(document.getElementsByTagName(" ...

  2. vue组件创建学习总结

    <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8&quo ...

  3. Java课程课后作业之19学期之第一周博客作业

    作为一个大二的学生,自己已经不小了,没有大一那个时候的无忧无虑的可以放纵的时光,只剩下一年,我就该做出我人生的下一个重大决定了,这一次真的是我一个人的决定,从小到大,父母为我做过很多的决定,即使在小的 ...

  4. Python练手例子(2)

    7.将一个列表的数据复制到另一个列表中. 程序分析:使用列表[:]. #python3.7 #适用于简单列表(即列表中都是基本的元素) a1 = [1,2] b1 = a1[:] print(b1) ...

  5. C语言一个程序的存储空间

    按区域划分: 堆区:自动分配内存区.//堆栈段 栈区:手动分配内存区.//堆栈段 全局(静态)区:静态变量和全局变量.//数据段(读写) 常量区:存放const全局变量和字符串常量.//数据段(只读) ...

  6. 香茅油:不只是驱虫剂 new

    如果您是芳香疗法的爱好者,香茅油对您来说可能并不陌生.香茅油还经常被添加到各种个人护理和清洁产品中,给人们带来多种益处. 什么是香茅油? 香茅精油是从香茅属 (Cymbopogon ) 植物家族中提取 ...

  7. in与exists和not in 与 not exists的区别

    1.in 与 exists: 外表大,用IN:内表大,用EXISTS: 原理: 用in:外表使用了索引,直接作hash连接: 用exists:内表使用了索引,外表作loop循环再进行匹配: 2.not ...

  8. Git branch && Git checkout常见用法

    https://www.cnblogs.com/qianqiannian/p/6011404.html git branch 和 git checkout经常在一起使用,所以在此将它们合在一起 1.G ...

  9. RxSwift 操作符

    RxSwift 操作符 (throttle) https://blog.csdn.net/weixin_38318852/article/details/80334838 RxSwift 操作符 (w ...

  10. mysql自动更新时间

    ALTER TABLE sys_user MODIFY COLUMN update_time TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDAT ...