• 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 Page 3

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 261
  • 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 (3)
  • 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 (124)

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

  • Miscellaneous (1)
Keep an EYE (0)
Solved Question (3) UnSolved Question (258)
Pages: 27FirstPrev123456789NextLast
Advertisements

(#M40167124) JAVA QUESTION Is array column size mandatory? Keep an EYE Keep an eye puzzle Keep an eye puzzle

Column size is mandatory to create an array in java. State true or false

Asked In Java Jax (3 years ago)
Unsolved
Is this Puzzle helpful?   (4)   (2) Submit Your Solution

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

Which constructs an anonymous inner class instance?
A. Runnable r = new Runnable() { };
B. Runnable r = new Runnable(public void run() { });
C. Runnable r = new Runnable { public void run(){}};
D. System.out.println(new Runnable() {public void run() { }});

Asked In Java (12 years ago)
Unsolved Read Solution (5)
Is this Puzzle helpful?   (13)   (0) Submit Your Solution Miscellaneous
Advertisements

(#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 (3 years ago)
Unsolved Read Solution (1)
Is this Puzzle helpful?   (8)   (11) Submit Your Solution

(#M40167118) JAVA QUESTION Number of string objects Keep an EYE Keep an eye puzzle Keep an eye puzzle

public String makingStrings()
{
String str = "Welcome";

str = str.substring(1, 5);

str = str.toUpperCase();

return str;
}

How many String objects are created in the heap when this method is invoked?

A. 4
B. 2
C. 3
D. 1

Asked In Java Jax (3 years ago)
Unsolved Read Solution (1)
Is this Puzzle helpful?   (3)   (1) Submit Your Solution Basics

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

Which of the following are legal lines of Java code?
1. int w = (int)888.8;
2. byte x = (byte)100L;
3. long y = (byte)100;
4. byte z = (byte)100L;
a) 1 and 2
b) 2 and 3
c) 3 and 4
d) All statements are correct.

Asked In Java Rajendra Singh (11 years ago)
Unsolved Read Solution (16)
Is this Puzzle helpful?   (132)   (51) Submit Your Solution Program

(#M40167121) JAVA QUESTION StringBuilder vs StringBuffer Keep an EYE Keep an eye puzzle Keep an eye puzzle

StringBuilder is less efficient and slower than StringBuffer. State true or false.

Asked In Java Jax (3 years ago)
Unsolved Read Solution (1)
Is this Puzzle helpful?   (0)   (1) Submit Your Solution

(#M40167122) JAVA QUESTION Output Keep an EYE Keep an eye puzzle Keep an eye puzzle

What is the output of the following program?

import java.util.regex.*;

class Test
{
public static void main(String args[])
{
Pattern p = Pattern.compile(".ech");
Matcher m = p.matcher("tech");
boolean b = m.matches();
System.out.println(b);
}
}

A. true
B. false
C. Compilation Error
D. Runtime Error

Asked In Java Jax (3 years ago)
Unsolved Read Solution (1)
Is this Puzzle helpful?   (0)   (1) Submit Your Solution

(#M40167123) JAVA QUESTION StringBuilder vs StringBuffer Keep an EYE Keep an eye puzzle Keep an eye puzzle

class MyLogger
{
private StringBuilder logger = new StringBuilder();
public void log(String message, String user)
{
logger.append(message);
logger.append(user);
}
}

The programmer must guarantee that a single MyLogger object works properly for a multi threaded system. How must this code be changed to be thread-safe?

A. Replace StringBuilder with StringBuffer

B. Replace StringBuilder with just a String object and use the string concatenation (+=) within the log method.

C. No change is necessary, the current MyLogger code is already thread-safe.

D. Synchronize the log method

Asked In Java Jax (3 years ago)
Unsolved Read Solution (1)
Is this Puzzle helpful?   (0)   (0) 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 (3 years ago)
Unsolved Read Solution (1)
Is this Puzzle helpful?   (1)   (1) Submit Your Solution Arrays

(#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 (12 years ago)
Unsolved Read Solution (3)
Is this Puzzle helpful?   (10)   (0) Submit Your Solution Program
Keep an EYE (0)
Solved Question (3) UnSolved Question (258)
Pages: 27FirstPrev123456789NextLast
  • Login
  • Register

Resend

Sponsored Links

Advertisements

Challenger of the Day

no image
Dimple
India
Punjab
Time: 00:01:33
Points
19

Maths Quotes

Mathematicians are not born,they are made

A M ANKIT KALLURAYA

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 5 years ago

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

yash mittal 5 years ago

Now enjoy Offline Access of latest Question.

Get M4maths app to avail expert's solution and latest selected questions.

Download m4maths app now

  • 2533K+Registerd user
  • 1774K+Engineers
  • 759K+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