Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

EX 1.4. public class B extends A { Point out the error(s) and how they can be fixed. private int a = 222; ham main

image text in transcribed
EX 1.4. public class B extends A { Point out the error(s) and how they can be fixed. private int a = 222; ham main la static nen ko the xai thuoc tinh non-static. Thuoc public static void main(String args) { tinh a o' class A vua la private vua la non-static nen cung ko the System.out.printIn("in main(): "); dung duoc. System.out.printIn("a = "+a ); Fix: them static vao truo'c thuoc tinh a o class B thanh static a = 123; private int a=222; hoac them static vao thuoc tinh a trong class A va sua access modifier thanh protected hoac public hoac default public class A { private int a = 100; public void setA( int value) { a = value; public int getA( { return a; } //class A

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Financial management theory and practice

Authors: Eugene F. Brigham and Michael C. Ehrhardt

12th Edition

978-0030243998, 30243998, 324422695, 978-0324422696

Students also viewed these Programming questions