• 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 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: 27123456789NextLast
Advertisements

(#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 (11 years ago)
Unsolved Read Solution (18)
Is this Puzzle helpful?   (136)   (44) Submit Your Solution Program

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

What will be the output of the following program?

class A
{
public void test()
{
System.out.println("Class A");
}
}
class Trial extends A
{
public void test()
{
System.out.println("Class Trial");
}
public static void main(String args[])
{
Trial object = (Trial)new A();
object.test();
}
}

A. Runtime Error
B. Compile Time Error
C. Class A
D. Class Trial

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

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

6. Which of the following refers to data encapsulation in object oriented programming?

A. The data and operations for an object are defined and fixed

B. The data of an object is encapsulated in its class

C. The data is hidden for an object

D.A class can have multiple object​

Asked In Java Mansoor (2 years ago)
Unsolved Read Solution (2)
Is this Puzzle helpful?   (4)   (0) Submit Your Solution Basics

(#M40029406) JAVA QUESTION java Keep an EYE Keep an eye puzzle Keep an eye puzzle

Q. Why there are no global variables in Java?

A. Global variables are globally accessible. Java does not support globally accessible variables due to following reasons:
1)The global variables breaks the referential transparency
2)Global variables creates collisions in namespace

Asked In Java MAN (12 years ago)
Unsolved
Is this Puzzle helpful?   (1)   (0) Submit Your Solution Definition

(#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 (11 years ago)
Unsolved Read Solution (12)
Is this Puzzle helpful?   (49)   (17) Submit Your Solution Program

(#M40167113) JAVA QUESTION instanceof question Keep an EYE Keep an eye puzzle Keep an eye puzzle

What will be the output of the program?

class Tree { }

class Pine extends Tree { }

class Oak extends Tree { }

public class Forest1
{
public static void main (String [] args)
{
Tree tree = new Pine();

if( tree instanceof Pine )
System.out.println ("Pine");

else if( tree instanceof Tree )
System.out.println ("Tree");

else if( tree instanceof Oak )
System.out.println ( "Oak" );

else
System.out.println ("Oops ");
}
}

A. Oops
B. Tree
C. Pine
D. Forest

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

(#M40167115) JAVA QUESTION Inheritance relationship in Java Keep an EYE Keep an eye puzzle Keep an eye puzzle

Which of the following statements are correct with respect to inheritance relationship in java?

A. object of subclass referenced by super class type can invoke super class methods
B. object of subclass referenced by super class type can access newly defined sub class variables
C. object of subclass referenced by super class type can access super class variables
D. object of subclass referenced by super class type can invoke overridden sub class methods
E. object of subclass referenced by super class type can invoke newly defined sub class methods

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

(#M40167117) JAVA QUESTION Access Modifiers Keep an EYE Keep an eye puzzle Keep an eye puzzle

Given a method in a public class, ________ access modifier must be used to restrict access to that method to only the other members of the same class.

A. final
B. private
C. protected
D. default

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

(#M40167119) JAVA QUESTION equals() vs == based question Keep an EYE Keep an eye puzzle Keep an eye puzzle

What is the output of the following program?

import java.util.Arrays;

class Test
{
public static void main(String args[])
{
String[] cities = new String[]{"London", "Paris", "NewYork", "HongKong", "Tokyo"};
String[] metros = new String[]{"London", "Paris", "NewYork", "HongKong", "Tokyo"};
String[] capitals = cities;
System.out.println("cities == metros : " + (cities == metros));
System.out.println("cities == capitals : " + (cities == capitals));
System.out.println("cities.equals(metros) : " + cities.equals(metros));
System.out.println("cities.equals(capitals) : " + cities.equals(capitals));
System.out.println("Arrays.equals(cities, metros) : " + Arrays.equals(cities, metros));
System.out.println("Arrays.equals(cities, capitals) : " + Arrays.equals(cities, capitals));
}
}


A. cities == metros : false
cities == capitals : true
cities.equals(metros) : true
cities.equals(capitals) : true
Arrays.equals(cities, metros) : false
Arrays.equals(cities, capitals) : true

B. cities == metros : false
cities == capitals : true
cities.equals(metros) : true
cities.equals(capitals) : true
Arrays.equals(cities, metros) : true
Arrays.equals(cities, capitals) : true

C. cities == metros : false
cities == capitals : true
cities.equals(metros) : false
cities.equals(capitals) : true
Arrays.equals(cities, metros) : true
Arrays.equals(cities, capitals) : true

D. cities == metros : false
cities == capitals : true
cities.equals(metros) : false
cities.equals(capitals) : true
Arrays.equals(cities, metros) : true
Arrays.equals(cities, capitals) : false

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

(#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 (3 years ago)
Unsolved Read Solution (2)
Is this Puzzle helpful?   (1)   (0) Submit Your Solution Basics
Keep an EYE (0)
Solved Question (3) UnSolved Question (258)
Pages: 27123456789NextLast
  • Login
  • Register

Resend

Sponsored Links

Advertisements

Challenger of the Day

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

Maths Quotes

Mathematics is like a rain... When we know how to solve it, We will continouosly do it.

Syawal

Common sense is the collection of prejudices acquired by age eighteen.

Albert Einstein

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