1)What are Web Services?
Web services are business logic components which provide functionality via. Internet using standard protocols such as HTTP. It is created using Soap or Rest. For E.g. in Google search page we got results like feeds, advertisement , news etc., from multiple sites, it is by web services which enables various websites to talk to each other and share data between them.
2)Differences between Soap vs. Rest.
SOAP – “Simple Object Access Protocol”
- SOAP is a method of transferring messages, or small amounts of information, over the Internet. SOAP messages are formatted in XML and are typically sent using HTTP (hypertext transfer protocol).
Rest – “Representational state transfer”
- Rest is a simple way of sending and receiving data between client and server and it doesn’t have very many standards defined. You can send and receive data as JSON, XML or even plain text. Its light weighted compared to SOAP.
3)How to create a DB connection.
Five steps to query a database:
- Load the driver
- Get connection
- Query the database
- Process the result set
- Close connection
4)Differences between prepared statement and callable statement.
- Prepared Statement – Execute a precompiled SQL with/without input parameters.
- Callable Statements – Execute a call to database stored procedure.
5)Difference between System. Out and System. Err.
System. Err is a PrintStream. System. Err works like System. Out except it is normally only used to output error texts. Some programs (like Eclipse) will show the output to System. Err in red text, to make it more obvious that it is error text.
6)What is Key Store?
Java Key Store (JKS) is a repository of security certificates, either authorization certificates or public key certificates – used for instance in SSL encryption.
7)Write a Java program to print Fibonacci series.
8)What is immutability in java?
Once created the objects state cannot be changed .E.g. string
9)How to create read only values in java.
Using final keyword
Final int a=4;
10)Difference between Hashmap and Hashtable.
- Hashtable is synchronized but Hashmap is not.
- Hashtable can’t contain null values but Hashmap permits null values.
11)Difference between Iterator and Enumeration.
- Iterator has remove () method but Enumeration do not have.
- Iterator is used to Add and remove object, enumeration is used to traverse and fetch objects.
- Iterator is used to manipulate text but Enumeration is used for read-only access.
12)Define Class-object relationship.
Object – Objects have states and behaviors. Example: A dog has states-color, name, and breed as well as behaviors -wagging, barking, and eating. An object is an instance of a class.
Class – A class can be defined as a template/ blue print that describe the behaviors/states that object of its type support.
Class is a blueprint while objects are actual objects existing in real word.
Get More Questions Related to
13)What to test while testing Client-server application.
- Integration between multiple components
- SOAK testing
- Multiple clients for same server
14)How to Read/write excel file in Java.
15)Write a java program to count number of unique words separated by comma (,) and their occurrence from text file.
16)Difference between int & INTEGER.
int is a primitive type. Variables of type int store the actual binary value for the integer you want to represent. int.parseInt(“1”) doesn’t make sense because int is not a class and therefore doesn’t have any methods.
Integer is a class, no different from any other in the Java language. Variables of type Integer store a reference to Integer objects, just as with any other reference type. Integer.parseInt(“1”) is calling the static method parseInt from class Integer (note that this method actually returns an int and not an Integer).
int type Declaration:
- count is a primitive
- count stores 32 bits of information (in the range Integer.MIN_VALUE to Integer.MAX_VALUE)
- Literal integers (e.g. 123 or 0x7b) are of type int
Integer type Declaration:
- count2 is an object reference
- count2 points to an object of type java.lang.Integer (or to null)
- The object count2 points at has an int member variable as described above.
To be more specific, Integer is a class with a single field of type int. This class is used where you need an int to be treated like any other object.
17)Difference between Serialization and synchronization.
- Serialization is a process by which object instance is converted into stream of bytes.
- Synchronization ensures that object data is into accessed by multiple threads at the same time.
18)Difference between sleep and wait. Which is better?
- Wait is better than sleep.
- Sleep cannot be waken but Wait can be woken using notify method.
- Sleeps do not release lock but Wait releases lock.
19)Difference between Array and ArrayList.
- Array size is fixed at the time of declaration. We can’t modify it.
- ArrayList size is not fixed at the time of declaration. We can change its contents.
20)Difference between Set and Map.
- Set – It is also an interface to represent linear collection with no duplicates. Order of insertion is not maintained. Example:- Harshest, Tree Set.
- Map – It represents an indexed collection i.e. key-value pairs. Example: – Hashmap.
21)What is AJAX?
- Conventional web application transmit information to and from the sever using synchronous requests. This means you fill out a form, hit submit, and get directed to a new page with new information from the server.
- XML is commonly used as the format for receiving server data, although any format, including plain text, can be used.
- AJAX is a web browser technology independent of web server software.
- A user can continue to use the application while the client program requests information from the server in the background
- Intuitive and natural user interaction.
- No clicking required only Mouse movement is a sufficient event trigger.
- Data-driven as opposed to page-driven
Original Source from : Java Training in Bangalore