Follow Quotesrain
  • Result
  • Today's Puzzle
    • Previous Puzzles
    • Prize & Rules
  • Discussion Board
    • Suggestion Board
    • Trending Articles
  • Maths Tricks
  • Placement Papers
    • Placement Questions
    • Interview Experience
    • Placed user Comment
    • Group Discussion
  • English APP
  • login
  • Result
  • Today's Puzzle
    • Previous Puzzles
    • Prize & Rules
  • Discussion Board
    • Suggestion Board
    • Trending Articles
  • Maths Tricks
  • Placement Papers
    • Placement Questions
    • Interview Experience
    • Placed user Comment
    • Group Discussion
  • Walkins
    • Corporate Job Exam
    • Government Job Exam
    • Entrance Exam
  • Training
    • Internship
  • Placement Questions
  • /
  • Java

Frequently Asked Java interview questions and answers for freshers

Java Select Another Category Select Another Topic

Programming and Technical

  • Android 118
  • ASP.NET 60
  • C 459
  • C++ 448
  • DATA STRUCTURE 66
  • DBMS 77
  • ELECTRONICS 39
  • Java 260
  • OOPs Concepts 117
  • Operating Syst 103
  • RDBMS 109
  • UNIX 70

Java Question Topics

    Category (1)

    General Ability (3)

  • General Knowledge (3)
  • HR Interview (3)

  • Interview (2)
  • Logical Reasoning (5)

  • Blood Relations (1)
  • Coding Decoding (2)
  • Cryptography (1)
  • Seating Arrangement (1)
  • Numerical Ability (4)

  • Algebra (1)
  • Number System (1)
  • Profit and Loss (1)
  • Programming (123)

  • Arrays (7)
  • Basics (2)
  • Database (4)
  • Definition (25)
  • Functions (2)
  • Output (3)
  • Program (20)
  • Puzzles (1)
  • Technical (40)
  • Verbal Ability (1)

  • Miscellaneous (1)
Keep an EYE (0)
Solved Question (3) UnSolved Question (257)
Pages: 26123456789NextLast
Advertisements

(#M40018946) JAVA QUESTION Advanced JAVA questions Keep an EYE Keep an eye puzzle Keep an eye puzzle

void start() {
A a = new A();
B b = new B();
a.s(b);
b = null; /* Line 5 */
a = null; /* Line 6 */
System.out.println("start completed"); /* Line 7 */
}

When is the B object, created in line 3, eligible for garbage collection?

A. after line 5
B. after line 6
C. after line 7
D. There is no way to be absolutely certain.

Asked In Java (9 years ago)
Unsolved Read Solution (2)
Is this Puzzle helpful?   (9)   (0) Submit Your Solution Program

(#M40018857) JAVA QUESTION JAVA QUESTIONS Keep an EYE Keep an eye puzzle Keep an eye puzzle

public void test(int x)
{
int odd = 1;
if(odd) /* Line 4 */
{
System.out.println("odd");
}
else
{
System.out.println("even");
}
}

Which statement is true?

A. Compilation fails.
B. "odd" will always be output.
C. "even" will always be output.
D. "odd" will be output for odd values of x, and "even" for even values.

Asked In Java (9 years ago)
Unsolved Read Solution (21)
Is this Puzzle helpful?   (67)   (25) Submit Your Solution Program
Advertisements

(#M40167137) JAVA QUESTION Java polymorphism Keep an EYE Keep an eye puzzle Keep an eye puzzle

class Mammal
{
String name= "Dog";
String makeNoise()
{
return "Bow Wow";
}
}

class Cat extends Mammal
{
String name="Cat";
String makeNoise()
{
return "Meow";
}
}

public class Main
{
void go()
{
Mammal m = new Cat();
System.out.println(m.name + m.makeNoise());
}
public static void main (String[] args)
{
new Main().go();
}
}

What is the output of the above program?

A. CatMeow
B. DogBow Wow
C. DogMeow
D. CatBow Wow

Asked In Java Jax (8 Months ago)
Unsolved
Is this Puzzle helpful?   (3)   (1) Submit Your Solution

(#M40031853) JAVA QUESTION Keep an EYE Keep an eye puzzle Keep an eye puzzle

What is the output of this program?

class average {
public static void main(String args[])
{
double num[] = {5.5, 10.1, 11, 12.8, 56.9, 2.5};
double result;
result = 0;
for (int i = 0; i < 6; ++i)
result = result + num[i];
System.out.print(result/6);

}
}
a) 16.34
b) 16.566666644
c) 16.46666666666667
d) 16.46666666666666

Asked In Java Rajendra Singh (8 years ago)
Unsolved Read Solution (17)
Is this Puzzle helpful?   (45)   (21) Submit Your Solution Program

(#M40167107) JAVA QUESTION Is Java is a structured programming language? Keep an EYE Keep an eye puzzle Keep an eye puzzle

State true or false. Java is a structured programming language.

A. True

B. False

Asked In Java Jax (9 Months ago)
Unsolved Read Solution (2)
Is this Puzzle helpful?   (3)   (1) Submit Your Solution

(#M40031854) JAVA QUESTION Keep an EYE Keep an eye puzzle Keep an eye puzzle

What is the output of this program?

class conversion {
public static void main(String args[])
{
double a = 295.04;
int b = 300;
byte c = (byte) a;
byte d = (byte) b;
System.out.println(c + " " + d);
}
}
a) 38 43
b) 39 44
c) 295 300
d) 295.04 300

Asked In Java Rajendra Singh (8 years ago)
Unsolved Read Solution (12)
Is this Puzzle helpful?   (37)   (11) Submit Your Solution Program

(#M40167132) JAVA QUESTION Exceptions 2 Keep an EYE Keep an eye puzzle Keep an eye puzzle

class ProductNotFoundException extends Exception {

//Some code

}

class Shop {

public void findProduct(int productId) throws ProductNotFoundException {

//some code

throw new ProductNotFoundException();

//some code

}

}

class ABCShop{

public void findProductsList(){

new Shop().findProduct(101);

}

}

Which of the following statement(s) are true for the above code?

A. This code will compile if we add throws ProductNotFoundException in the signature of method findProductsList().
B. This code will compile but returns no output
C. This code will compile if we add a try-catch block in findProductsList().
D. This code will compile if in method findProductsList () returns a list instead of void

Asked In Java Jax (8 Months ago)
Unsolved
Is this Puzzle helpful?   (1)   (1) Submit Your Solution

(#M40167126) JAVA QUESTION static import Keep an EYE Keep an eye puzzle Keep an eye puzzle

Identify the correct options from the classes provided below.
More than one may be correct.

A. import static edu.ABC.model.Account.*;
public class Loan {
public double getInterest() {
return INTEREST_RATE;
}
}

B. import static edu.ABC.model.Account ;
public class Loan {
public double getInterest() {
return INTEREST_RATE;
}
}

C. import edu.ABC.model.Account ;
public class Loan {
public double getInterest() {
return Account.INTEREST_RATE;
}
}

D. package edu.ABC.model;
public class Loan {
public double getInterest() {
return INTEREST_RATE;
}
}

Asked In Java Jax (8 Months ago)
Unsolved
Is this Puzzle helpful?   (1)   (0) Submit Your Solution Arrays

(#M40167116) JAVA QUESTION Java Polymorphism question Keep an EYE Keep an eye puzzle Keep an eye puzzle

What is the output of the following program?

class Icecream
{
public void displayName(String s)
{
System.out.println(s+" "+"Icecream");
}
public void describe(String s)
{
System.out.println(s+" "+"Icecream: Ice cream is a sweetened frozen food typically eaten as a snack or dessert. ");
}
}

class Faloodeh extends Icecream
{
public void displayName(String s)
{
System.out.println(s+" "+"Faloodeh ");
}

public void describe(String s)
{
System.out.println(s+" "+"Faloodeh: Faloodeh is often served alongside Persian-style dairy-based ice cream ");
}
}

public class Test
{
public static void main(String arg[])
{
Icecream a = new Faloodeh();
Faloodeh b = (Faloodeh)a;
a.displayName("test");
b.displayName("test");
a.describe("test");
b.describe("test");
}
}

A. test Faloodeh: Faloodeh is often served alongside Persian-style dairy-based ice cream
test Faloodeh: Faloodeh is often served alongside Persian-style dairy-based ice cream
test Faloodeh
test Faloodeh

B. test Faloodeh
test Faloodeh
test Faloodeh: Faloodeh is often served alongside Persian-style dairy-based ice cream
test Faloodeh: Faloodeh is often served alongside Persian-style dairy-based ice cream

C. test Faloodeh
test Faloodeh: Faloodeh is often served alongside Persian-style dairy-based ice cream
test Faloodeh: Faloodeh is often served alongside Persian-style dairy-based ice cream
test Faloodeh

D. test Faloodeh: Faloodeh is often served alongside Persian-style dairy-based ice cream
test Faloodeh
test Faloodeh
test Faloodeh: Faloodeh is often served alongside Persian-style dairy-based ice cream

Asked In Java Jax (8 Months ago)
Unsolved Read Solution (1)
Is this Puzzle helpful?   (0)   (0) Submit Your Solution Output

(#M40167127) JAVA QUESTION Checked vs Unchecked exceptions Keep an EYE Keep an eye puzzle Keep an eye puzzle

Which exceptions should be explicitly handled or properly propagated?

A. Unchecked exceptions
B. Checked exceptions
C. Errors
C. None of the above

Asked In Java Jax (8 Months ago)
Unsolved Read Solution (1)
Is this Puzzle helpful?   (1)   (0) Submit Your Solution Basics
Keep an EYE (0)
Solved Question (3) UnSolved Question (257)
Pages: 26123456789NextLast
  • Login
  • Register

Resend

Sponsored Links

Advertisements

Challenger of the Day

G.S.Kantharao
G.S.Kantharao
India
Andhra Pradesh
Time: 00:03:33
Points
17

Maths Quotes

If no Maths,no life

me

AS A KEY OPENS THE DOOR, MATHS IS THE KEY TO ALL PROBLEMS WHICH ARE THEORITICALLY PROVED.

REDDY GARU

Placed User Comments

M4Math helped me a lot.

Vipul Chavan 1 year ago

Thanks m4 maths for helping to get placed in several companies.
I must recommend this website for placement preparations.

yash mittal 2 years ago
  • 2431K+Registerd user
  • 1702K+Engineers
  • 729K+MBA Asprirant
  • 3K+Enginnering College
  • 250+Company Exam
  • 150K+Interview Questions
  • Site Links
  • Home
  • Result
  • Today's Puzzle
  • Discussion Board
  • Maths Tricks
  • Advertise with us
  • Contact Us
  • Useful Info
  • Maths Quotes
  • Previous Puzzles
  • Prize
  • Privacy Policy
  • Disclaimer and Copyright
  • Terms and Conditions
  • Sitemap
  • Placement papers
  • TCS Placement Paper
  • HCL Placement Paper
  • INFOSYS Placement Paper
  • IBM Placement Paper
  • SYNTEL Placement Paper
  • TECHNICAL Interview
  • HR Interview
All rights are reserved to @m4maths.com