Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

What is the output of the third 'println' statement in the main method? public class A{ int i; static int s; public static void main(String[]

image text in transcribed
What is the output of the third 'println' statement in the main method? public class A{ int i; static int s; public static void main(String[] args) { A a1 = new A(); System.out.println("A1.i is " + a1.i+"A1.s is " + a1.s); A a2 = new A(); System.out.println("A2.i is " + a2.i+ " A2.s is " + a2.s); A a3 = new A(); System.out.println("A3.I is " + a3.1 + " A3.s is " + a3.s); } public A() { s++; } } O A3.i is 1 A3.s is 2 O A3.i is 2 A3.s is 3 O A3.i is 1 A3.s is 3 A3.i is 2 A3.s is 2

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

Step: 3

blur-text-image

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

Modern Database Management

Authors: Jeffrey A. Hoffer Fred R. McFadden

9th Edition

B01JXPZ7AK, 9780805360479

More Books

Students also viewed these Databases questions