Jul 26

Explain try with resource statement with example in java

Number of View: 119

 

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: 619

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: 549

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: 543

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: 758

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: 779

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: 515

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