Why not evolve JavaScript
Why not evolve JavaScript? Brandon Eich, the inventor of JavaScript, is clearly not happy about Dart, favouring evolution of the language via standards and committee. Personally I don’t think this is working at the moment for a couple of reasons. Firstly, HTML5 is upon us and gaining popularity fast, JavaScript desperately needs some attention, fast! Secondly, non-backward-compatible or breaking changes are not possible via evolution, there are features of JavaScript that really need to be broken in order to fix them.
What about jQuery and other popular libraries? If Dart is really going to fix JavaScript, I would imagine that existing JavaScript libraries will not work with it. The web developer community will probably find it hard to accept Dart without jQuery.
Will everyone adopt it? This is probably the most important question of all. It is clearly Google’s aim that everyone does adopt Dart, then they will pass it over to committee, just as JavaScript was passed over to ECMA. The problem is, what’s in it for the other browser manufacturers? How will they benefit by adopting Dart? To be honest, I can’t see any benefict for Mozilla, Microsoft or anyone else. Lars (Google Tech Lead) has promised to Lars to “sweet talk” the other browser vendors, which in acknowledges the issue they face, but since when has sweet talking been part of the browser wars?
Core Java Interview Questions
- Why the container does not support multiple layout managers
- Which class is the super class for all classes in java.lang package?
- What are differences between Enumeration, ArrayList, Hashtable and Collections and
- How many JVM could be run on an operating system. if only one then what is the logical reason.
- What is JVM Heap Size? How does it affect the performance of the Application?
- We know that Object class is super class of every class & a class extends only one class. so How is it possible to a class to extend other than Object class?
- What is difference between string and stringtokenizer?
- How can you load DLL files when your java class is loading first time ?
- If two overloaded methods are - test(Object xyz) and test(Customer cust) [Assume Customer is a class with member name of type String]. Now if we call test(null), which method will be called? why?
- When are you using arraylist and linkedlist?
- When are you using hashmap and hashtable?
- Can we have run() method directly without start() method in threads?
- How to use JNI in Java? What are Struts and Jini? How to apply native code in Java?
- Can we have run() method directly without start() method in threads?
- How to use JNI in java? and what are Struts and jini?and how to apply native code in java?
- Strings are immutable.But String s="Hello"; String s1=s+"World"; S.O.P(s1); means printing "HelloWorld". How ?
- What is the difference between classpath and path variable?
- If we have two public classes in a single java file, How I have to give the name of the particular java file and How I can compile it?
- Is there any difference between Execution Engine and the JIT in java?
- How single threaded model works after implementation in class, basically architecture point of view?
How can I enable session tracking for JSP pages if the browser has disabled cookies – jsp interview questions
We know that session tracking uses cookies by default to associate a session identifier with a unique user. If the browser does not support cookies, or if cookies are disabled, you can still enable session tracking using URL rewriting. URL rewriting essentially includes the session ID within the link itself as a name/value pair. However, for this to be effective, you need to append the session ID for each and every link that is part of your servlet response. Adding the session ID to a link is greatly simplified by means of of a couple of methods: response.encodeURL() associates a session ID with a given URL, and if you are using redirection, response.encodeRedirectURL() can be used by giving the redirected URL as input. Both encodeURL() and encodeRedirectedURL() first determine whether cookies are supported by the browser; if so, the input URL is returned unchanged since the session ID will be persisted as a cookie.
Consider the following example, in which two JSP files, say hello1.jsp and hello2.jsp, interact with each other. Basically, we create a new session within hello1.jsp and place an object within this session. The user can then traverse to hello2.jsp by clicking on the link present within the page. Within hello2.jsp, we simply extract the object that was earlier placed in the session and display its contents. Notice that we invoke the encodeURL() within hello1.jsp on the link used to invoke hello2.jsp; if cookies are disabled, the session ID is automatically appended to the URL, allowing hello2.jsp to still retrieve the session object. Try this example first with cookies enabled. Then disable cookie support, restart the brower, and try again. Each time you should see the maintenance of the session across pages. Do note that to get this example to work with cookies disabled at the browser, your JSP engine has to support URL rewriting.
hello1.jsp
<%@ page session=\"true\" %>
<%
Integer num = new Integer(100);
session.putValue("num",num);
String url =response.encodeURL("hello2.jsp");
%>
<a href=\'<%=url%>\'>hello2.jsp</a>
hello2.jsp
<%@ page session="true" %>
<%
Integer i= (Integer )session.getValue("num");
out.println("Num value in session is " + i.intValue());
%>
Common Java Interview questions
Java interview questions can be difficult. So you should be very careful about your preparation prior to appearing for any Java interview question. So you need to take an in-depth preparation before facing your interviewer. This article sheds light on different types of java questions that are common to find in different interview sessions. Quite obviously, being a java developer is not only a prestigious career option but also it offers good compensation as well.
There is a great variety of questions that can be asked during interview. These may include queries regarding difference between String and StringBuffer; difference between interface and abstract class; experience with open source; difference between EJB and Hibernate; usage of Spring; knowledge about Websphere and WSAD; discussion about struts; class in JDK; difference between final, finally and finalize; experience with XP/Agile; JUnit; etc.
Few interviewers may instill answering practical questions during java interview session. He may ask you to define abstract class with good examples; interface with examples; explanation of synchronization. The interviewer may also show you an example, and ask you relevant questions based on the given example. The interviewer may also ask you to write program code as instructed the interviewer. These types of questions may cover different areas of core java, JSP/Servlets, EJB, JMS, JDBC, RMI and Swing.
Due to its lucrative career option, one may choose the appropriate career path to become a java professional. In fact, if someone is aspired for being a java professional, he may choose to appear for different java certification exams as well.
10 Java Interview Questions
*Q11. Explain the usage of Java packages.
A. This is a way to organize files when a project consists of multiple modules. It also helps resolve naming conflicts when different packages have classes with the same names. Packages access level also allows you to protect data from being used by the non-authorized classes.
*Q12. If a class is located in a package, what do you need to change in the OS environment to be able to use it?
A. You need to add a directory or a jar file that contains the package directories to the CLASSPATH environment variable. Let's say a class Employee belongs to a package com.xyz.hr; and is located in the file c:\dev\com\xyz\hr\Employee.java. In this case, you'd need to add c:\dev to the variable CLASSPATH. If this class contains the method main(), you could test it from a command prompt window as follows:
c:\>java com.xyz.hr.Employee
*Q13. What's the difference between J2SDK 1.5 and J2SDK 5.0?
A.There's no difference, Sun Microsystems just re-branded this version.
*Q14. What would you use to compare two String variables - the operator == or the method equals()?
A. I'd use the method equals() to compare the values of the Strings and the == to check if two variables point at the same instance of a String object.
*Q15. Does it matter in what order catch statements for FileNotFoundException and IOExceptipon are written?
A. Yes, it does. The FileNoFoundException is inherited from the IOException. Exception's subclasses have to be caught first.
*Q16. Can an inner class declared inside of a method access local variables of this method?
A. It's possible if these variables are final.
*Q17. What can go wrong if you replace && with & in the following code:
String a=null; if (a!=null && a.length()>10) {...}
A. A single ampersand here would lead to a NullPointerException.
*Q18. What's the main difference between a Vector and an ArrayList
A. Java Vector class is internally synchronized and ArrayList is not.
*Q19. When should the method invokeLater()be used?
A. This method is used to ensure that Swing components are updated through the event-dispatching thread.
*Q20. How can a subclass call a method or a constructor defined in a superclass?
A. Use the following syntax: super.myMethod(); To call a constructor of the superclass, just write super(); in the first line of the subclass's constructor.
jsp interview questions, What is a output comment
A comment that is sent to the client in the viewable page source.The JSP engine handles an output comment as uninterpreted HTML text, returning the comment in the HTML output sent to the client. You can see the comment by viewing the page source from your Web browser.
JSP Syntax
<!-- comment [ <%= expression %> ] -->
Example 1
<!-- This is a commnet sent to client on
<%= (new java.util.Date()).toLocaleString() %>
-->
Displays in the page source:
<!-- This is a commnet sent to client on January 24, 2004 -->