Friday, 11 October 2013

Techniques

1. File Search: select whole word, select case sensitive

JDBC Template

If your Query returns single value then use NamedParameterJdbcTemplate:
---------------------------------------------------------------------------

String fanNumber = new NamedParameterJdbcTemplate(
        getJdbcTemplate()).queryForObject(getSQL("OM.GET_ADH_NUM"), params, String.class);

Wednesday, 25 September 2013

Maven

Maven build fail:
1. http://stackoverflow.com/questions/2222560/build-failed-question-maven-jre-or-jdk-problem

Thursday, 12 September 2013

eclipse

EGit

Error occurred while discarding changes in local git repository, then we can use "Hard Reset"
http://wiki.eclipse.org/EGit/User_Guide

Monday, 9 September 2013

Java Preparation Tutorials


  1. Core Java: http://www.javatpoint.com/java-what-where-and-why
  2. Servlet: http://www.javatpoint.com/servlet-tutorial
  3. JSP: http://www.javatpoint.com/jsp-tutorial
  4. Struts: http://www.java4s.com/struts-tutorials/index-struts-framework/
  5. Spring: http://www.java4s.com/spring/index-spring-framework/
  6. Spring MVC: 
  7. Hibernate: http://www.java4s.com/hibernate/hibernate-framework-index/
  8. jQuery: http://www.codeproject.com/Articles/618484/LatestjQuery-interview-questions-and-answers
  9. Spring Security
  10. JavaScript Interview Questions and Answers
  11. Java Web Services: http://javabrains.koushik.org/2013/06/ws01-introduction-to-web-services.html
  12. CSS3 Browser compatibility issues: http://www.amicontech.com/blog/css3-compatibility-with-all-browsers-including-ie/
  13. AngularJS: https://www.thinkful.com/learn/angularjs-tutorial-build-a-gmail-clone/#Introduction
  14. JavaScript: http://javascript.info/

Java Interview Questions

1.       Q1
1.1.    Set
1.2.    ArrayList
1.3.    HashMap
1.4.    JSP Life cycle
1.5.    Dependencty Injection
1.5.1. Setter Injection
1.5.2. Constructor Injection
1.6.    Abstract
1.7.    Interface
1.8.    How Hibernate is integrated in your project?
1.9.    Static
1.10.Final
1.11.Struts Vs Spring
1.12.Write the code for setter injection and constructor injection
2.       Q2
2.1.    Where did you use interfaces in your project?
2.2.    What are the problems you faced in your project?
2.3.    ArrayList Vs LinkedList
2.4.    Exception?
2.5.    Servlet?
2.6.    doGet Vs doPost
2.7.    ServletContex Vs ServletConfig
2.8.    Servlet Wrapper classes
2.9.    JSP Life cycle
2.10.Implicit Objects of JSP
2.11.Include directive Vs include action
2.12.Driver class types
2.13.ORM ?
2.14.Core interfaces of Hibernate?
2.15.get() Vs load() of Hibernate?
2.16.Sorted and Ordered collections of Hibernate
2.17.Hibernate proxy?
2.18.Hibernate Cache types?
2.19.Object states of Hibernate?
2.20.Struts flow
2.21.Use of Action class of struts
2.22.Struts validation framework
2.23.Struts taglib
2.24.Dependency Injection
2.25.Auto wiring & Bean wiring
2.26.How to integrate struts with spring
2.27.Tx Management
2.28.Inner join
2.29.Did you use any reporting tool?
2.30.SVN?
3.       Q3
3.1.    Hibernate configuration?
3.2.    What is SessionFactory? Is it thread-safe?
3.3.    What is Session? Can you session object between different threads?
3.4.    Detached state?
4.       Q4
4.1.    What is Set?
4.2.    Why Set doesn’t allow duplicates, Why and How?
4.3.    Overloading:
methodXxx(int x, int y) { …. }
methodXxx(double x, double x) { … }
Which method will execute when calling as methodXxx(10, 10);
4.4.    Write code for descending order collection
4.5.    When will you get NullPointerException
4.6.    ArrayList vs LinkedList. Which is better?
4.7.    HashMap vs Hashtable
4.8.    String s1 = null;
String s2 = null;
s1.equals(s2); à what is the result?
4.9.    What is use of hashCode()
4.10.equals() Vs hashCode(). Can we use hashCode() to compare objects? Which is the better method for comparing?
4.11.Comparable Vs Comparator
4.12.Hibernate Named Quereis?
4.13.Criterial Queries?
4.14.Projections in Hibernate?
4.15.get() Vs load()
4.16.What is lazy loading?
4.17.update() Vs merge()
4.18.what is use of @NamedQuery
4.19.How do you integrate Spring and Hibernate?
4.20.On which modules of Spring you worked?
4.21.What is DTO?
5.       Q5
5.1.    Can you write web.xml code
5.2.    Deployment directory structure
5.3.    Write code of Singleton class
5.4.    Write logic for Palindrome
5.5.    How did you do source code management
6.       Q6
6.1.    Quick sort, Merge sort, Bubble sort, Binary search
6.2.    How JVM works?
6.3.    Vector Vs ArrayList
6.4.    SprngMVC flow
6.5.    Explain about Spring security. How it works?
6.6.    Palindrome
6.7.    What is use of Interfaces in java
6.8.    Hibernate Named Queries
6.9.    Inner Join, Left Join, Outer Join, Self Join
6.10.HashMap: How do you write sorting order logic
6.11.How to iterate Map
7.       Q7 - jQuery
7.1.    deligate()
7.2.    eq() Vs get()
7.3.    $(this) Vs this
7.4.    Slowest selectors
7.5.    Fast selectors
7.6.    bind() vs live()
7.7.    each()
7.8.    parent()
7.9.    How to stop animation
7.10.What is DOCTYPE
7.11.onload() vs ready()
8.       Q8
8.1.    How to integrate Spring and Hibernate
8.2.    Criteria Queries
8.3.    Joins – Inner join, Outer join
8.4.    Sort strings without using Java API provided classes and methods
8.5.    Named Queries
8.6.    Singleton design pattern
8.7.    Java7 features
8.8.    What is Serialization
9.       Q9
9.1.    empty() Vs remove() Vs detach()
9.2.    eq() Vs get().    (jQuery)
9.3.    How to get sibling nodes
9.4.    Slowest and Fastest selectors
9.5.    Types of Cookies
9.6.    What is JSON? What is use of JSON?
9.7.    JSON Vs XML
9.8.    What is AJAX?
9.9.    What is CSS?
9.10.What is Aglie process?
9.11.What is chaining? (jQuery)
10.   Q10
10.1.Union   (SQL)
10.2.Union All   (SQL)
10.3.lock()    (Hibernate)
10.4.What are the problems you have faced in your project?
10.5.Can we write super() after this()
10.6.Can we execute static block without main() method?
11.   Q11
11.1.Add Employee objects to a Map and print all the Employee details
11.2.What did you do with JSP in your project?
11.3.Can we declare protected method in interface?
11.4.Can we declare private variable in interface?
11.5.How will you deploy your project?
11.6.How will you get the production tickets?
11.7.How will you pull your code changes into production server?
11.8.Where is the document name that you used to write test cases using junit?
11.9.How will you get the project code?
11.10.   How you run your project?
11.11.   Did you write any maven goal to deploy your project?
11.12.   Why we can’t create object for abstract class?
11.13.   What are the tools you used in your project?
11.14.   What is the use of static block?
11.15.   Write a query to select max salary from a table?
11.16.   Write a query to select second max salary from a table?
11.17.   Explain OOPs  concepts
11.18.   Can we override static methods?
11.19.   What is the difference between struts1 and struts2 ?
11.20.   What is MVC?
11.21.   How did you do server side validations?
11.22.   What is the general meaning of persistence?
11.23.   How you create the Logger object?
11.24.   How you write ANT Script or Maven Script to deploy your project?
11.25.   How do you see log files of Dev/Production Environment?
12.   Q12:
12.1.How do you write code for retrieving Employee data from EMPLOYEE table?
12.2.What is Tx Managment?
12.3.What is requiresnew (Tx Mgmt)?
12.4.How can you traverse List(Collection) of Employees?
12.5.How to write for each loop?
12.6.How much fast you can learn new technologies?
12.7.How much good you in programming?
13.   Q13:
13.1.How many types of style-sheets are there?
13.2.Can you implement jQuery Accordion on your own without using jQuery?
13.3.What did you do with jQuery in project?
13.4.Did you have experience in web designing?
13.5.What is diff between live() and bind() methods?
13.6.What is DOCTYPE
13.7.How to write CSS for Chat window?
13.8.Write CSS for page with Header, Body, Footer and Left pannel.
13.9.What is diff between live() and on() methods?
14.   Q14
14.1.onload() Vs ready()   (jQuery)
14.2.IOC
14.3.List Vs Set Vs Map
14.4.What are the Core interfaces of Hibernate?
14.5.bind() Vs live()
14.6.Directive include, Action include examples. (JSP)
14.7.What is DOCTYPE
14.8.How do you check whether a textbox is empty or not?
15.   2S1
15.1.What are the Design patterns you know and what Design patterns you were used?
15.2.What is Difference between BeanFactory container and Application Context container?
15.3.How to write Named Queries with Annotations in Hibernate?
15.4.How many years’ experience you have in each technology that you know? (maintain a table with info)
15.5.Where did you use Serialization and how did you use?
16.   2S2
16.1.What is Exception Hierarchy?
16.2.What are the sub classes of Throwable?
16.3.What are the differences between Set and List?
16.4.How Set will restrict duplicate elements?
16.5.What are methods of Object class?
16.6.What are the differences between get() and load() methods?
16.7.I have list with all employee objects, and I want to creat TreeSet with this list? How can I do this? Don’t do any changes in Employee class and anyway we can’t do any changes in TreeSet.
16.8.How to implement Tx Management? There is a method with is in Transactional and sub method which was called inside of that method and it should be not there in that Transactional, how to do this?
17.   2S3
17.1.Java script data type?
17.2.Create object in java script?
17.3. 
a=1;
b="1"
a=b; ?
a==b; ?
a===b; ?
17.4.Create array object in javascript?
17.5.push vs pop in javascript?
17.6.shift vs unshift ?
17.7.splice vs slice?
17.8.Html5 vs previous Html versions?
17.9.how to include css files into our files?
17.10.   how many types in style sheets?
17.11.   a.css and b.css contain phone class so <div class="phone"> which class will be called ?
17.12.   null vs undefined
17.13.   RESTFULL vs SOAP ?
17.14.   methods in RESTFULL ?
17.15.   GET vs POST ?
17.16.   @RequestParam, @PathVariable and @RequestMapping?
17.17.   How to make method level parameter as required for spring @RequestMapping method?
17.18.   @ResponseBody
17.19.   @RequestBody
18.   2S4:
18.1.Filter example for uppercase
18.2.Java reverse string in optimized way
18.3.How arraylist grow dynamically
18.4.Array vs ArrayList
18.5.Fibonacci series using recursive function.
18.6.String constant pool
18.7.$provider
18.8.Application Security (Software vulnerabilities) / Input validation errors:
18.8.1.    Format string attacks
18.8.2.    SQL injection
18.8.3.    Code injection
18.8.4.    E-mail injection
18.8.5.    Directory traversal
18.8.6.    Cross-site scripting in web applications
18.8.7.    HTTP header injection
18.8.8.    HTTP response splitting
19.   2S5:
19.1.What is the use of component-scan tag in spring?
19.2.Print cross matrix values?
19.3.How Map internally works?
19.4.Spring Request to Response flow
19.5.When we give the Parent class reference to child class object?
19.6.Java Collections
20.   2S6:
20.1.UI:
20.1.1.    AJAX call syntax
20.1.2.    Write code to find checked checkboxes for a group of checkboxes
20.1.3.    Write code for click event in using jQuery
20.1.4.    How to insert an item into an array without removing/overriding any existing item.
20.1.5.    What is typeof in JavaScript
20.2.Java:
20.2.1.    Output: final Map m; m.put(“a”, “x”); m.put(“a”, “x”);
20.2.2.    Write code to override hashCode()
20.2.3.    Use of hashCode
20.2.4.    Can two different objects have same hash codes?
20.2.5.    How @Autowire works
20.2.6.    Spring pre initialize and post initialize methods of container??
20.2.7.    How to inject properties file into spring bean?
20.2.8.    How to create a DAO class?
20.2.9.    @Component Vs @Repository. When to use these?
20.2.10. What is meaning CASCADE TYPE true?
20.2.11. What is Lazy loading?
21.   2S7:
21.1.Default ArrayList size?
21.2.Explain OOPS concepts for this Room
21.3.Comparable Vs Comparator
21.4.In which case/requirement you overideded equals() and hashCode() methods of HashMap?
21.5.Which technique is used in HashMap?
21.6.How HashMap internally works?
22.   2S8:
22.1.How to get values from HashMap?
22.2.How HashMap internally works?
23.   2S9:
23.1.Normalization
23.2.Maven artifact
23.3.Front Controller Design pattern
23.4.String reverse without using String function(s)
23.5.Spring cache -xml configuration
24.   2S10: (core java, J2ee, CSS, html , spring and struts, database)
24.1.Project architecture
24.2.What tech you use?
24.3.Where you work, what are issues are you faced?
24.4.Some examples of the different type of issues how you solved?
25.   2S11:
25.1.HTTP – OPTIONS? (http://stackoverflow.com/questions/12111936/angularjs-performs-an-options-http-request-for-a-cross-origin-resource)
25.2.How to include font files?
25.3.Write a gulp task for minifying files.
25.4.How to configure node to your project with and without Maven?
26.   2S12:
26.1.Pessimistic and optimistic locking
26.2.JavaScript Hoisting
26.3.What are the Guidelines for RESTFULL WebServices?
26.4.Did you consider anytime implementing REST APIs instead Spring Controllers?
26.5.What is the scope of variables in JavaScript?
27.   2S13:
27.1.paragraph color dynamically and static
27.2.array of array of elements -à get specific element
28.   2S14:
28.1.W.a.p. using Comparable
28.2.W.a.p. using Comparator
28.3.W.a.p using Runnable
28.4.W.ap. using Thread
28.5.Angular – filter a country
28.6.W.a.p. On submit of form send data to RESTFULL webservice
28.7.SOAP Vs REST
28.8.Explain the request flow to the RESTFULL method
28.9.Explain the request flow to the Controller method
28.10.   How you get requirement and how you implement it
28.11.   Your project functional architecture or systems hierarchy. How the data flows and for what.
29.   2S15:
29.1.Web Accessibility
29.2.Disadvantages of external style sheets
29.3.SEO-Search Engine Optimization
29.4.RWD
29.5.Bootstrap Framework
29.6.Media Queries
29.7.HTML API sheets - Web worker,
29.8.HTML Form Elements
29.9.Clear position method - HTML
29.10.   Diff between Canvas/SVG
29.11.   Draw a line using Canvas - Draw function we have in canvas
29.12.   What are the applicable values you can define for Z-index
29.13.   $rootscope
29.14.   Syntax for Factory method.
29.15.   Syntax for implementing Routing
29.16.   Angular Validations
29.17.   Differentiate Link and compile
29.18.   Disadvantages of angular js.
29.19.   Nested controllers
29.20.   Browser compatibility Issues.
30.   2S16:
30.1.Examples of angular factory, service, controller and filter
30.2.Array elements – sort in ascending order
30.3.Angular one way and two way data bindings
30.4.Angular project folder structure
30.5. 
31.   Programs:
31.1.        class A {
       public int x = 2;
       public void m1() {
              System.out.println("A m1");
       }
}
class B extends A{
       public int x = 3;
       public void m1() {
              System.out.println("B m1");
       }
}
public class Inherit1 {
       public static void main(String[] args) {
              A a = new B();
              System.out.println(a.x); // ???
              a.m1(); //???
       }
}
31.2.             

32.    3S1:


1.     What is the most complex and satisfied task you did in your career?
2.   Why/Use of Java wrapper classes?
2.       HashMap Vs Hashtable
3.       Spring Dependency Injection types?
4.       How to integrate Hibernate with Spring?
5.       How to identify and inform IT team when a service or server is down?
6.       Did you work on Spring Boot?
7.       Did you work on microservices?

8.    Write java code how do you sort numbers and strings?
33. 3S2:
       1.       Program - Do not allow consecutive characters
       2.       Program - Count repeated words in a sentence
       3.       Program - Count curly braces
       4.       Spring Integration

34. 3S3:
1.       Employee objects sort with id and name in alphabatical order (41, 'ram'), (12, 'ravi'), (33, 'other'). For names here, can't we use string natural sorting order?
2.       sql query - city and county tables - group by country's population
3.       how do you define class as a spring bean?

4.       Can we instantiate abstract class?

35.