[Updated] Goldman Sachs Aptitude Test Questions and Answers
Practice List of TCS Digital Coding Questions !!!
Take 50+ FREE!! Online Data Interpretation Mock test to crack any Exams.

Technical Interview Questions and Answers :: Java

    1 / 66


    Difference between StringBuffer and StringBuilder
    Answer:

    StringBuffer:




    1. StringBuffer is less efficient than StringBuilder.

    2. StringBuffer is synchronized i.e. thread safe. It means two threads can't call the methods of StringBuffer simultaneously.



    StringBuilder:




    1. StringBuilder is more efficient than StringBuffer.

    2. StringBuilder is non-synchronized i.e. not thread safe. It means two threads can call the methods of StringBuilder simultaneously.

    Please Login First :

    2 / 66

    Why doesn't Java support multiple inheritance?
    Answer:

    Java doesn't supports multiple inheritence because it causes ambiguity.

    Please Login First :

    3 / 66

    Write a JDBC program to retrieve student details?
    Answer:

    import java.sql.*;


    public class stuinfo{


    public static void main(String ar[]){


    try[


    class.forName("sun.jdbc.odbc.JdbcOdbcDriver");


    Connection con=DriverManager.getConnection("Jdbc:Odbc:stu");


    Statement st=con.createStatement();


    ResultSet rs=st.excecuteQuery("select * from studin");


    while(rs.next()){


    String name=rs.getString(1);


    String rollno=rs.getString(2);


    int m1=rs.getInt(3);


    int m2=rs.getInt(4);


    int m3=rs.getInt(5);


    String dept=rs.getString(6);


    int year=rs.getInt(7);


    System.out.ptintln("Name:" name);


    System.out.ptintln("Roll No.:" rollno);


    System.out.ptintln("Marks1 :" m1);


    System.out.ptintln("Marks2 :" m2);


    System.out.ptintln("Marks3 :" m3);


    System.out.ptintln("Department :" dept);


    System.out.ptintln("Year :" year);


    }


    }catch(Exception e){System.out.println ("Exception" e);}


    }


    }

    Please Login First :

    4 / 66

    How you implement https in JSP?
    Answer:

    No Discussion on this question yet!

    Please Login First :

    5 / 66

    What are collections in java?
    Answer:

    A collection is an object that can hold references to other objects. The collection interfaces declare the operations that can be performed on each type ofcollection. The classes and interfaces of thecollections framework are in package java.util.

    Please Login First :

    6 / 66

    What are the exceptions in java?
    Answer:

    An exception (or exceptional event) is a problem that arises during the execution of a program. When an Exception occurs the normal flow of the program is disrupted and the program/Application terminates abnormally.

    Please Login First :

    7 / 66

    What are the types of classes in java?
    Answer:

    there are two classes.
    outer class
    inner class

    Please Login First :

    8 / 66

    What are the various concepts of java?
    Answer:

    various concept of java
    1.abstraction
    2.pollymorphisum
    3.inheritance
    4.encapsulation
    5.object
    6.class

    Please Login First :

    9 / 66

    How many ways to create object in Java?
    Answer:

    There are 5 ways to create an object in java.

    1. using new keyword

    2. using Object class clone() method

    3. using deserialization readObject()

    Please Login First :

    10 / 66

    What is the difference between final variable and constant in Java?
    Answer:

    .Final variable

    Please Login First :