Answered step by step
Verified Expert Solution
Question
1 Approved Answer
please figure out the reasons for these answers new Mac p in public class A public void m1 System.out.println(m1); ) public void m2 System.out.println(m2); )
please figure out the reasons for these answers
new Mac p in public class A public void m1 System.out.println("m1"); ) public void m2 System.out.println("m2"); ) public static void main (String[) args) m10 // Line 1 m20// Line 2 Which lines have compilation erro (A) Line 1 (B) Line 2 (C) Line 1 and line 2 (3 marks) Consider the following Java (D) None class public class B public static int x; public int y; public B) ( public void inc) and the following code fragment B refi -new B0; B ref2 -new B0; ref1.incO ref2.inc); Which values do ref2.x and ref2. y have after executing this code? (2 marks) Consider the following two Java classes. public class B private void m10 System.out.println ("m1); public void m2 System.out println("m2 public B) public class A extends B public AO B varB new BO varB.m10 // Line 1 varB.m2; //Line 2 Which line(s) will cause compilation error(s)? (A) Line (B)Line2 (C) Lines 1 and 2 (D) NoneStep by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started