You are on page 1of 5

NL NL O NP

a ~ = ~ ~= = c = = g~ ~= n = ^ ` = = J= m ~ = ~= ^

Search

Arithmetic Aptitude Data Interpretation Logical Reasoning Verbal Reasoning Non Verbal Reasoning General Knowledge Sudoku Number puzzles Missing letters puzzles Logical puzzles Playing cards puzzles Clock puzzles C Programming C++ Programming C# Programming Java Programming Microbiology Biochemistry Biotechnology Biochemical Engineering Mechanical Engineering Chemical Engineering Networking Database Questions Computer Science Basic Electronics Digital Electronics Electronic Devices Circuit Simulation Electrical Enigneering Engineering Mechanics Technical Drawing Placement Papers Group Disucssion HR Interview Technical Interview Body Language Aptitude Test Verbal Ability Test Verbal Reasoning Test Logical Reasoning Test C Programming Test Java Programming Test Data Interpretation Test General Knowledge Test Data Structures Operating Systems Networking DATABASE Database Basics SQL Server Basics SQL Server Advanced SQL Server 2008 JAVA Core Java Java Basics Advanced Java UNIX Unix File Management Unix Memory Management Unix Process Managemnt C Interview Questions The C Language Basics .NET Interview Questions .NET Framework ADO.NET ASP.NET Software Testing Aptitude Reasoning Verbal Ability GK Puzzles Programming Engineering Medical Interview Online Test

Java Programming :: Declarations and Access Control


@ : Home > Java Programming > Declarations and Access Control > Finding the output

Cloud Computing Course


Simplilearn.com/Cloud-Course-Delhi

Get 5% Discount-Use 'welcome2013'. EXIN Certification, Enroll Now!

K ~ L~ ~J ~ J~J~J M Q M K ~ L ~ LMMN

NL R

NL NL O NP

a ~ = ~ ~= = c = = g~ ~= n = ^ ` = = J= m ~ = ~= ^

1. What will be the output of the program?


casA ls { fnlpbi itGteutita itb {rtr 0 } ia ulc n eRsl(n , n ) eun ; } casBetnsA ls xed { pbi itGteutita itb {eun1 } ulc n eRsl(n , n ) rtr ; } pbi casTs ulc ls et { pbi sai vi mi(tigag[) ulc ttc od anSrn rs] { Bb=nwB) e (; Sse.u.rnl(x="+bGteut0 1) ytmotpitn" .eRsl(, ); } }

A. x = 0 B. x = 1 C. Compilation fails. D. An exception is thrown at runtime. Answer & Explanation Answer: Option C Explanation: The code doesn't compile because the method GetResult() in class A is final and so cannot be overridden. View Answer Workspace Report Discuss in Forum 2. What will be the output of the program?
pbi casTs ulc ls et { pbi sai vi mi(tigag[) ulc ttc od anSrn rs] { casFo ls o { pbi iti=3 ulc n ; } Ojc o=(betnwFo) bet Ojc)e o(; Fofo=(o); o o Foo Sse.u.rnl(i="+foi; ytmotpitn" o.) } }

A. i = 3
K ~ L~ ~J ~ J~J~J M Q M K ~ L ~ LMMN OR L

NL NL O NP

a ~ = ~ ~= = c = = g~ ~= n = ^ ` = = J= m ~ = ~= ^

B. Compilation fails. C. i = 5 D. A ClassCastException will occur. Answer & Explanation Answer: Option A Explanation: No answer description available for this question. Let us discuss. View Answer Workspace Report Discuss in Forum 3. What will be the output of the program?
pbi casA ulc ls { vi A)/ Ln 3* od ( * ie / { Sse.u.rnl(CasA) ytmotpitn"ls "; } pbi sai vi mi(tig]ag) ulc ttc od anSrn[ rs { nwA) e (; } }

Ads by Google

Java Programming Java API Creating a Will

A. Class A B. Compilation fails. C. An exception is thrown at line 3. D. The code executes with no output. Answer & Explanation Answer: Option D Explanation: Option D is correct. The specification at line 3 is for a method and not a constructor and this method is never called therefore there is no output. The constructor that is called is the default constructor. View Answer Workspace Report Discuss in Forum

Exercise
General Questions Finding the output Pointing out the correct statements "Two things are infinite: the universe and human stupidity; and I'm not sure about the universe." - Albert Einstein

4. What will be the output of the program?


casSpr ls ue { pbi iti=0 ulc n ; pbi SprSrn tx)/ Ln 4* ulc ue(tig et * ie / { i=1 ; } } casSbetnsSpr ls u xed ue { pbi SbSrn tx) ulc u(tig et { i=2 ; } pbi sai vi mi(tigag[) ulc ttc od anSrn rs] { Sbsb=nwSb"el"; u u e u(Hlo) Sse.u.rnl(u.) ytmotpitnsbi; } }

A.0 C.2
K ~ L~ ~J ~ J~J~J M Q M K ~ L ~ LMMN

B.1 D.Compilation fails.


PL R

NL NL O NP

a ~ = ~ ~= = c = = g~ ~= n = ^ ` = = J= m ~ = ~= ^

Answer & Explanation Answer: Option D Explanation: A default no-args constructor is not created because there is a constructor supplied that has an argument, line 4. Therefore the sub-class constructor must explicitly make a call to the super class constructor:
pbi SbSrn tx) ulc u(tig et { sprtx) / ti ms b tefrtln cntutr ue(et; / hs ut e h is ie osrco i=2 ; }

View Answer Workspace Report Discuss in Forum 5. What will be the output of the program?
pbi casTs ulc ls et { pbi itaehd) ulc n Mto( { sai iti=0 ttc n ; i+ +; rtr i eun ; } pbi sai vi mi(tigag[) ulc ttc od anSrn rs] { Ts ts =nwTs(; et et e et) ts.Mto(; etaehd) itj=ts.Mto(; n etaehd) Sse.u.rnl() ytmotpitnj; } }

A.0 C.2 Answer & Explanation Answer: Option D Explanation:

B.1 D.Compilation fails.

Compilation failed because static was an illegal start of expression - method variables do not have a modifier (they are always considered local). View Answer Workspace Report Discuss in Forum 12Next >

The Rackspace Cloud


Rackspace.com/CloudServers

Scalable Servers in Minutes From $17 per Month. Get Your Server Now!

K ~ L~ ~J ~ J~J~J M Q M K ~ L ~ LMMN

QR L

NL NL O NP

a ~ = ~ ~= = c = = g~ ~= n = ^ ` = = J= m ~ = ~= ^
Ads by Google

Java Language

Java Program

Java Classes

Java Runtime

Read more: Declarations and Access Control - Pointing out the correct statements

2008-2012 by IndiaBIX T echnologies. All Rights Reserved | Copyright | T erms of Use & Privacy Policy Contact us: info@indiabix.com Bookmark to: Follow us on twitte r!

K ~ L~ ~J ~ J~J~J M Q M K ~ L ~ LMMN

RL R