How to Create a Text File in Java
In this article we will see how to create a text file in java. In this example, we’ll use the PrintWriter class. package com.javatechig; import java.io.FileNotFoundException; import...
View ArticleCopying the Contents of One text file to Another in Java
In this example, we will see a sample program to copying the contents of one text file to another in Java. package com.javatechig; import java.io.File; import java.io.FileInputStream; import...
View ArticleCopy file from one folder to another in java
This example explains how to Copy file from one folder to another in java. package com.javatechig; import java.io.File; import java.io.FileInputStream; import java.io.FileNotFoundException; import...
View ArticleHow to delete and rename a file in java
This post provides sample program explaining how to delete and rename a file in java Rename file in Java package com.javatechig; import java.io.File; import java.io.IOException; public class RenameFile...
View ArticleCount line word and characters in file
In this example we’ll see how to count line, word and characters in file. package com.javatechig; import java.io.BufferedReader; import java.io.File; import java.io.FileNotFoundException; import...
View ArticleJava Thread Interview Questions And Answers
In this post we will see some of the most asked Java Thread interview questions with answers. Q: What is a Thread? A thread is a class in java belongs to java.lang package. A thread is an lightweight...
View ArticleJava Collections Interview Questions
In this post we will see some of the most asked Java Collections related interview questions with answers. Q: What is the Collections API? The Collections API provides set of classes and interfaces...
View ArticleCore Java Interview Questions
In this post we will see some of the random core Java interview questions and answers. Q: What is a variable? Variable is a named memory location that can be easily referred in the program. A variable...
View ArticleJava Exception Interview Questions
Q: What is an Exception? The exception is said to be thrown whenever an exceptional event occurs in java which signals that something is not correct with the code written and may give unexpected...
View ArticleJava Garbage Collection Interview Questions
In this tutorial we will touch upon some of the most commonly asked Java garbage collection interview questions. Q: Explain garbage collection and how can you force the garbage collection? Garbage...
View ArticleIf-then and if-then-else Statements in Java
If-else statement in java is used for conditional checks for decision making. You can have multiple hierarchies of if-else statements. Once any of the if or else-if condition satisfies it executes the...
View ArticleSet JAVA_HOME Environment Variable Mac Os x
In this tutorial, we show you how to set $JAVA_HOME environment variable on your Mac OS X. Mac OSX 10.5.x or later Open the Terminal program present in your (this is in your Applications/Utilities...
View ArticleCovariant return type example in java
In Java 5, we have feature called covariant return type. Prior to Java5, we could not change the return type of the overridden method. It means that if you override the method in the subclass you need...
View ArticleInvoke Method Using Java Reflection
Java provides reflection API to do introspection of an object and modify its behavior on the run time. The class Class in the Java API forms the basis to identify the object class and its internal...
View Article
More Pages to Explore .....