Tag Archives: java

How to read and parse CSV file

JavaIO

This tutorial shows how to read, parse and print out the values from a CSV file. Say we have a CSV file user-profile.csv where the user name, roll number, age, course name is stored, seperated by comma. Sample file data “Aman”,”A1234″,23,”B.Tech” “Rahul”,”A1235″,21,”B.Tech” “Ravi”,”A1236″,24,”B.Tech” “Maxwell”,”A1237″,23,”B.Tech” “Patrick”,”A1238″,26,”B.Tech” “John”,”A1239″,20,”B.Tech” Extracts the Roll Number and Course from above CVS file, and print it out. ... Read More »

Difference between JDK, JRE and JVM

Java

If we are a Java developer, it is very often that we think about understanding the JRE,JVM and JDK. It would be quite easy for us to visualize things in logical manner. Let’s see the basic differences between the JDK, JRE and JVM. JDK (Java Development Kit) Java Developer Kit contains tools needed to develop the Java programs, and JRE ... Read More »

Regular Expression in Java

Java

Java provides the java.util.regex package for pattern matching with regular expressions. A regular expression is a special sequence of characters that helps you match or find other strings or sets of strings, using a specialized syntax held in a pattern. They can be used to search or edit or manipulate data. The java.util.regex package primarily consists of the following three ... Read More »

Getting System Out to Write to a Particular File on System

JavaIO

This tutorial redirects the System.out to a file provided by the user. Steps to follow – 1. Create a file myconsole.txt. 2. Create a PrintStream which uses FileOutputStream 3. Set the System Out with PrintStream object. package com.jkoder; import java.io.File; import java.io.FileNotFoundException; import java.io.FileOutputStream; import java.io.PrintStream; public class RedirectSystemOutput { public static void main(String[] args) throws FileNotFoundException { System.out.println("This output ... Read More »