GT's Blog
Code snippets, technical articles, tips on computing and programming...
Pages
(Move to ...)
Type in Nepali Unicode Romanized - Convert Roman Nepali to Unicode Tool
▼
Showing posts with label
Java Interview QA
.
Show all posts
Showing posts with label
Java Interview QA
.
Show all posts
Java Map Comparison- hashmap, linkedhashmap, treemap
›
Java Map Comparison : HashMap is the fastest map with O(1) search and insertion times. LinkedHashMap is a little slower for inserts, bu...
Java iterate through map, hashmap - working source code
›
Iterating through Map in Java - working efficient source code Map<String, Object> map = ...; The solution uses map.keySet(), map....
Top Java Interview Question : reverse a string using recursion
›
Best Answer using Recursion : public String reverse(String str) { if ((null == str) || (str.length() <= 1)) { return st...
Call one constructor from another in Java
›
Is this possible to call one constructor from another in Java ? Yes, it is possible: public class Foo { private int x; public F...
Scenarios in which Serialization cannot happen
›
What are the special cases in which serialization cannot happen? -> There are following scenarios in which serialization cannot happen: a...
redirect message to IO stream
›
How could Java classes direct program messages to the system console, but error messages, say to a file? The class System has a variable ou...
How to serialize variables selectively
›
In a Java class, one has 10 variables. One wants to serialize only 3 variables,how can this be achieved? ->Make variables as ' trans...
The usage of Java packages.
›
Explain the usage of Java packages. A. This is a way to organize files when a project consists of multiple modules. It also helps resol...
Java: difference between private, protected, and public?
›
These keywords are for allowing privileges to components such as java methods and variables. Public : accessible to all classes Private : ...
Order of catching exception in java
›
Does it matter in what order catch statements for FileNotFoundException and IOExceptipon are written? A. Yes, it does. The FileNotFoundEx...
wrapper classes in Java
›
Describe the wrapper classes in Java. Wrapper class is wrapper around a primitive data type. An instance of a wrapper class contains, or wra...
Java Class as Applet as well as Application
›
Can you write a Java class that could be used both as an applet as well as an application? A. Yes. Add a main() method to the applet.
Redirect Standard System Output and Error Message to PrintStream in Java
›
In a Java program, how can you divert standard system output or error messages, say to a file? ->We can achieve this by using public st...
difference between an interface and an abstract class
›
What's the difference between an interface and an abstract class? Also discuss the similarities. (Very Important) Abstract class is a ...
›
Home
View web version