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)
上一篇 2022年8月1日 下午11:46
下一篇 2022年8月1日 下午11:46


相关推荐

  • webrtc开发入门_统计的简单应用

    webrtc开发入门_统计的简单应用WebRTC介绍及简单应用WebRTC,即WebRealTimeCommunication,web实时通信技术。简单地说就是在web浏览器里面引入实时通信,包括音视频通话等。WebRT

    2022年8月1日
    7
  • 基于Intel PXA272的Bootloader的设计与实现

    基于Intel PXA272的Bootloader的设计与实现

    2021年7月28日
    69
  • pycharm编译器设置_bash python

    pycharm编译器设置_bash python第一步:安装flake8运行cmd.exe,直接输入:pipinstallflake8安装完成后,用flake8-h检查是否安装成功第二步:配置打开pyCharm,在File->Settings->Tools->ExternalTools中点击“+”。Program:$PyInterpreterDirectory$/python Arguments:-mflake8–statistics$Pro…

    2025年11月6日
    5
  • mybatiscodehelperpro激活码【2021.10最新】

    (mybatiscodehelperpro激活码)2021最新分享一个能用的的激活码出来,希望能帮到需要激活的朋友。目前这个是能用的,但是用的人多了之后也会失效,会不定时更新的,大家持续关注此网站~IntelliJ2021最新激活注册码,破解教程可免费永久激活,亲测有效,下面是详细链接哦~https://javaforall.net/100143.html…

    2022年3月28日
    989
  • OpenSSL、OpenSSL-FIPS、OpenSSL-FIPS-ECP的区别

    OpenSSL、OpenSSL-FIPS、OpenSSL-FIPS-ECP的区别在OpenSSL的官网上可以看到三个分支,分别是openssl-、openssl-fips-、openssl-fips-ecp-。这三者的区别如下。 分支 内容差异 openssl- 完整版的OpenSSL openssl-fips- 把密码函数库单独抽出来,做成一个满足FIPS1…

    2022年7月20日
    19
  • python 菜鸟教程 正则_华为mate30好用不

    python 菜鸟教程 正则_华为mate30好用不正则表达式简介正则表达式,是一个特殊的字符序列,又称规则表达式(英语:RegularExpression,在代码中常简写为regex、regexp或RE),本质而言是一种小型的,高度专业化的编程语言。Python自1.5版本起增加了re模块,re模块使Python语言拥有全部的正则表达式功能。正则语法表关于正则语法表,别想其他的都背过就行了。不管你是python还是其他…

    2026年3月12日
    4

发表回复

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

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