Thursday, October 20, 2016

Java Interview Questions with Clients in Singapore 2016

Standard Chartered Bank --- Core Java --Automation testing and integration

How locking works in Concurrent Hash Map?
How to find the middle element in a singly linked list?
What is transient in Java?
What are the continuous development and deployment tools used?

Standard Chartered Banks -- JavaScript /Java/J2EE

How Spring MVC works
what is bulbing and capturing in javascript?
How do you  implement validation in Javascript?

Equinix -------Java/J2EE interview

Array  list vs Linked List, Which one is fastest and why?
Write a function to sort a list of String.
How do you implement authentication(login) in web application.
How do you check weather the request is authenticated or not?
Different scope of spring beans and what is the default scope?
What happen when singleton scope bean is accessed in session bean?
What is the difference between send redirect and forward?

Global Blue------------ Java Swing

write a java program or Implement Hash Map using core java..

AIA-------------

What is hibernate?
What happens after txn.commit()?
Where do you implement transactions? service or DAO and why?
Explain arch of your project?
How hibernate save data to the database table
What is the advantage of using ORM
Why hibernate ?
Why we have to use angularJS ?

Tuesday, March 3, 2015

Java Code to Send Mail From Gmail

package src;

import java.util.Properties;
import javax.mail.*;
import javax.mail.internet.*;

public class Sendmail {
 public static void main(String[] args) {

 String to="TomailAddr@gmail.com";//change accordingly

  //Get the session object
  Properties props = new Properties();
  props.put("mail.smtp.host", "smtp.gmail.com");
  props.put("mail.smtp.socketFactory.port", "465");
  props.put("mail.smtp.socketFactory.class",
            "javax.net.ssl.SSLSocketFactory");
  props.put("mail.smtp.auth", "true");
  props.put("mail.smtp.port", "465");
  Session session = Session.getDefaultInstance(props, null);

 
  //compose message
  try {
   MimeMessage message = new MimeMessage(session);
   message.setFrom(new InternetAddress("yourgmailid@gmail.com"));//change accordingly
   message.addRecipient(Message.RecipientType.TO,new InternetAddress(to));
   message.setSubject("Hello");
   message.setText("Testing.......");

    Transport transport = session.getTransport("smtp");
transport.connect("smtp.gmail.com", "MailID@gmail.com", "YourPassword");
transport.sendMessage(message, message.getAllRecipients());
transport.close();

 
   System.out.println("message sent successfully");
 
  } catch (MessagingException e) {throw new RuntimeException(e);}
 
 }
}  

Saturday, November 23, 2013

Advanced Java interview Questions

1)Write a program to find the no of instance of a class ?
2)Why java packages root starts with "com" or "Org" ?
3)What is the difference between composition and inheritance in Java?And when to use?
4)How is sorting implemented in java?
5)What is the Max size of a Java Object?
6)How java uses stack and heap?
7)How Singletons are maintained in a Clustered Environment?
   There are two methods :
      a ) Oralce/Java Coherence
      b) Teracotta
           http://www.infoq.com/articles/open-terracotta-intro
9) How is static and class variable stored in Java?
10) How can we prevent overriding of a method?
11) How can you create a memory leak?
12) Difference between a static class and singleton.
13) What happens to reference object when we serialize an object?
14) Tagged or marked interface??
15) static and Dynamic Binding?
16) Class A inherits class B. What happens to class A if class B is Serializable? Will Class A get Serialized? If yes what to do to stop class A from getting serialized?
17) Why is string immutable?
18) String.equals() and String== difference
19) Why Overriding Hash code requires over riding of Equal()?
20)If 2 war files are deployed in same tomcat server. How can you access a class file in one war from other?

 

Monday, August 27, 2012

Playing with Asterisk patterns-6

Java code for getting the following patterns:
Method receives String array with input String XYZ combinations and an integer varaible for the size of the String to be displayed.

X,Y,Z size=3

* *
 *
* *

* *
 *
 *

***
  *
*
***
XYZ, size=7

*   *
 * *
  *
 * *
*   *
*   *
 * *
  *
  *
  *
*****
  *
 *
*
*****

XYZ, Size=9

*      *
 *   *
  * *
   *
  * *
 *   *
*     *
*      *
 *   *
  * *
   *
   *
   *
   *
*******
    *
   *
  *
 *
*******
Java code:




Thursday, August 23, 2012

Playing with Asterisk patterns-5

Java code for generating the following pattern:

            *
           * *
          * * *
         * * * *
        * * * * *
       * * * * * *
      * * * * * * *
     * * * * * * * *
    * * * * * * * * *
   * * * * * * * * * *

Playing with Asterisk patterns-4

Java code for generating the following pattern :

      *
     **
    ***
   ****
  *****
 ******
 ******
  *****
   ****
    ***
     **
      *

Playing with Asterisk patterns-3

Java code for generating the following pattern:

      *
     **
    ***
   ****
  *****
 ******

Playing with Asterisk patterns-2

Java Code for generating the following pattern:
*
 * *
  *  *  *
   *   *   *   *
    *    *    *    *    *
     *     *     *     *     *     *

Playing with Asterisk patterns-1

Java Code for generating the following "*" patterns.

*
**
***
****
*****
******
******
*****
****
***
**
*