abstractmethoderror:某方法_error parse true

abstractmethoderror:某方法_error parse trueAbstractMethodError:Thisjava.lang.AbstractMethodErrorisusuallythrownwhenwetrytoinvokethe

大家好,又见面了,我是你们的朋友全栈君。如果您正在找激活码,请点击查看最新教程,关注关注公众号 “全栈程序员社区” 获取激活教程,可能之前旧版本教程已经失效.最新Idea2022.1教程亲测有效,一键激活。

Jetbrains全系列IDE使用 1年只要46元 售后保障 童叟无欺

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)

版权声明:本文内容由互联网用户自发贡献,该文观点仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 举报,一经查实,本站将立刻删除。

发布者:全栈程序员-站长,转载请注明出处:https://javaforall.net/167044.html原文链接:https://javaforall.net

赞 (0)
全栈程序员-站长的头像全栈程序员-站长


相关推荐

  • IDEA 激活服务器破解方法

    IDEA 激活服务器破解方法,https://javaforall.net/100143.html。详细ieda激活码不妨到全栈程序员必看教程网一起来了解一下吧!

    2022年3月15日
  • hostapd的分析[通俗易懂]

    hostapd的分析[通俗易懂]Hostapd的功能就是作为AP的认证服务器,负责控制管理stations(通常可以认为带无线网卡的PC)的接入和认证。通过Hostapd可以将无线网卡切换为AP/Master模式,通过修改配置文件,可以建立一个开放式的(不加密)的,WEP,WPA或WPA2的无线网络。并且通过修改配置文件可以设置无线网卡的各种参数,包括频率,信号,beacon包时间间隔,是否发送beacon包,如果响应探针请求

    2022年5月21日
  • java使用md5_Java_MD5的使用「建议收藏」

    java使用md5_Java_MD5的使用「建议收藏」在Java中使用MD5摘要还是很方便的,直接上代码。1packagecom.cxc.nothing;23importjava.nio.charset.Charset;4importjava.security.MessageDigest;56publicclassMD5Test{7publicstaticvoidmain(String[]args){89…

    2022年7月7日
  • [编剧] 尼克·皮佐拉托谈获益最多的小说——转载「建议收藏」

    [编剧] 尼克·皮佐拉托谈获益最多的小说——转载「建议收藏」[编剧] 尼克·皮佐拉托谈获益最多的小说——转载

    2022年4月21日
  • tcp四次挥手,为什么是四次?「建议收藏」

    tcp四次挥手,为什么是四次?「建议收藏」四次挥手的原因;为什么要有TIME_WAIT状态?2MSL的的意义;四次挥手中如果有一次挥手失败怎么处理?

    2022年5月5日
  • wxPython的基础教程

    wxPython的基础教程写在前面的话:上个假期学习了Python,发现它真的是一门很有趣的语言,所以这学期想学一些python的可视化编程,于是选择了wxPython。但是我在网上找中文教程找了好久都没有找到中文的教程(额,也许是我方法不对),无奈只好看英文的啦。于是在这个网站上看完了wxPython的基础教程,但是为了方便广大网友所以决定将这个网页中的内容翻译过来。花费了3个晚上的时间,终于把它翻译完了。但是我只是一个

    2022年5月21日

发表回复

您的邮箱地址不会被公开。 必填项已用 * 标注

关注全栈程序员社区公众号