Aug 16

Explain serialization and deserialization in java with example?

Number of View: 184

Serialization :

When the data was written to disk, certain information was lost, such as the type of each value. For example, if the value "10" is read from a file, there’s no way to tell whether it came from an int, a String or a double. We have only data, not type information, on a disk.

we want to read an object from or write an object to a file or over a network connection. Java provides a concept called serialization for this purposes. Continue reading

Jul 26

Explain try with resource statement with example in java

Number of View: 245

 

The try-with-resources:

Java 7 added a new construct called try-with-resources.

To understand try with resources we need to understand how resources are handled before java7.Before

Java 7, when we worked with a resource, such as a file, a SQL statement, etc., you had to use a finally

block and write a few lines of boilerplate code to close the resource.

Continue reading

Jan 25

Java Interview questions -part 5

Number of View: 717

Java Interview Quiz -Part 5

Start
Congratulations - you have completed Java Interview Quiz -Part 5. You scored %%SCORE%% out of %%TOTAL%%. Your performance has been rated as %%RATING%%
Your answers are highlighted below.
Return
Shaded items are complete.
12345
End
Return
Jan 25

Java Interview Quiz-part 4

Number of View: 613

Java Interview Quiz -Part 4

Start
Congratulations - you have completed Java Interview Quiz -Part 4. You scored %%SCORE%% out of %%TOTAL%%. Your performance has been rated as %%RATING%%
Your answers are highlighted below.
Return
Shaded items are complete.
12345
67End
Return
Jan 25

Java Interview Questions -Part 3

Number of View: 623

Java Interview Quiz -Part 3

Start
Congratulations - you have completed Java Interview Quiz -Part 3. You scored %%SCORE%% out of %%TOTAL%%. Your performance has been rated as %%RATING%%
Your answers are highlighted below.
Return
Shaded items are complete.
12345
End
Return
Jan 25

Java Interview Questions -Part 2

Number of View: 822

Java Interview Quiz -Part 2

Start
Congratulations - you have completed Java Interview Quiz -Part 2. You scored %%SCORE%% out of %%TOTAL%%. Your performance has been rated as %%RATING%%
Your answers are highlighted below.
Return
Shaded items are complete.
12345
End
Return
Jan 25

Java Interview Quiz -part 1

Number of View: 865

Java Interview Quiz -Part 1

Start
Congratulations - you have completed Java Interview Quiz -Part 1. You scored %%SCORE%% out of %%TOTAL%%. Your performance has been rated as %%RATING%%
Your answers are highlighted below.
Return
Shaded items are complete.
12345
6End
Return
Jan 11

Write a java program to Create a new file using file.separator in java

Number of View: 650

File.separator is used to obtain the local computer’s proper separator character instead of explicitly using / or \. For example On a Windows computer, the separator character is a backslash (\).
On a Linux or Mac OS X system, it’s a forward slash (/).
File.separator is a String consisting of one character—the proper separator for the system. Continue reading