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. python语法_str_eval

    dict1 = {} a = str(dict1) type(a) = 字符串 b = eval(a) type(b) = 字典

  2. 配置Mqtt

    一.java后台调用MQTT 准备工作:需要导入的jar包 <!-- mqtt依赖包--> <dependency> <groupId>org.fusesource ...

  3. SQL之NULL值的几种处理方式

    1.创建测试表: drop table if exists tab_null_operator; create table tab_null_operator as select 1 as id,'c ...

  4. Go并发示例-Pool

    https://mp.weixin.qq.com/s/MBY6l5VxrFPJ4AA8nGeQUQ <Go语言实战>笔记(十六) | Go并发示例-Pool 飞雪无情 异步图书 2017- ...

  5. mysql视图、存储过程等

    视图: 需求: 创建的临时表(select * from tb1)被反复使用,这时可以为该临时表创建视图.视图相当于为某个查询创建了别名. 1.创建视图 create view v1 as selec ...

  6. ps去掉图片上的文字

    使用仿制图章工具去除文字这是比较常用的方法,具体的操作是,选取仿制图章工具,按住Alt键,在无文字区域点击相似的色彩名图案采样,然后在文字区域拖动鼠标复制以覆盖文字.要注意的是,采样点即为复制的起始点 ...

  7. poj1164

    #include<iostream> using namespace std; ][]; ][]; int roomnum; int maxroom; int m,n; typedef s ...

  8. ant安装报错:ANT_HOME is set incorrectly or ant could not be located. Please set ANT_HOME.

    后来发现问题原因是没有设置classpath,或者是\的原因: 正确配置如下:  ANT_HOME:D:\ant\apache-ant-1.10.5 CLASSPATH: %ANT_HOME%\lib ...

  9. linux 环境变量函数getenv()和putenv()的使用

    环境变量相关函数: getenv()和putenv() 代码示例[Linux程序设计(4th)_4.2小节配套代码]: 程序功能:编写一个程序来打印所选的任意环境变量的值:如果给程序传递第二个参数,还 ...

  10. vue + ts @Prop boolean 问题

    假设btn组件有一prop属性radio,声明如下 @Prop({ default: false }) radio!: boolean; 在组件传递 <btn radio /> 此时的 r ...