How to convert an array into a collection object?

How to convert an array into a collection object?
DeeKay October 6, 2011 at 7:33 pm · java.util

Below java code example show how to convert an array into a Collection object. To convert array based data into list / collection, we can use java.util.Arrays class. This class provide a static method asList(Object[] a) that converts array into list / collection. OUTPUT: TOM JACK JILL JANE


How to get Date/Day, Month and Year of the current date?

How to get Date/Day, Month and Year of the current date?
DeeKay October 6, 2011 at 6:22 pm · java.util

Below java code example shows how to get date, month and year from the current date


How to convert String to Date in java?

How to convert String to Date in java?
DeeKay October 5, 2011 at 11:15 pm · java.util

Below code shows how to convert String to Date in java. It converts String Object to java.util.Date


How to remove line from file in java?

How to remove line from file in java?
DeeKay October 3, 2011 at 11:27 pm · java.io

Below java code shows how to remove line from file


How to rename file in java? How to change file name in java?

How to rename file in java? How to change file name in java?
DeeKay October 3, 2011 at 11:06 pm · java.io

Below java code shows how to rename a file or change a file name


How to read data from InputStream to a String in Java?

How to read data from InputStream to a String in Java?
DeeKay September 30, 2011 at 1:27 am · java.io

Below java code shows how to read data from InputStream to a String –


How to get list of files using FileFilter class in java?

How to get list of files using FileFilter class in java?
DeeKay September 30, 2011 at 12:33 am · java.io

Below java code shows how to get list of files using FileFilter class. FileFilter is an abstract class used by JFileChooser for filtering the set of files shown to the user. A FileFilter can be set on a JFileChooser to keep unwanted files from appearing in the directory listing.   Reference: Java Docs


How to use lazy val in Scala and what is the difference between lazy val and val ?

How to use lazy val in Scala and what is the difference between lazy val and val ?
DeeKay September 30, 2011 at 12:03 am · Scala

Difference between val and lazy val is that, a val is executed when it is defined whereas lazy val is executed when it is accessed for the first time. Below example shows how to use val and lazy val –


Symbols used in Syntax of Scala Language

Symbols used in Syntax of Scala Language
DeeKay September 25, 2011 at 2:47 am · Scala

Scala Lang has many different symbols used in its syntax. Below is the list of symbols and its use in Scala language. “->” arrow symbol in Scala syntax returns a two element tuple containing the key and value. You can use this symbol as shown in below example- Map(1->”Allan”, 2->”Bob”) (1).->(“A) “_” underscore symbol  in scala syntax is intended as…
Continue Reading »


How to Install Scala 2.9.1 on Linux (Ubuntu 11.04) ?

How to Install Scala 2.9.1 on Linux (Ubuntu 11.04) ?
DeeKay September 25, 2011 at 1:07 am · Scala

To install Scala on Linux you need to get scala on your Linux machine. You can get Scala by below two methods : 1) Default Scala version available on your Linux box by typing below command sudo apt-get install scala 2) If you want to get the latest version of the scala below are the…
Continue Reading »


Java Code Example for Hello World Program

Java Code Example for Hello World Program
DeeKay September 23, 2011 at 12:38 am · basic

Every beginner who starts programming in any language writes Hello World Program. Java Programmer is not exception for Hello World program. Below is the java version of Hello World Program. To start with Hello World java program you need to create HelloWorld.java file, Once you created file write class HelloWorld. The name of class and…
Continue Reading »


How to read file using FileChannel in java code?

How to read file using FileChannel in java code?
DeeKay September 22, 2011 at 6:25 pm · java.nio

Below java code shows example of how to read file using FileChannel –


Java Code Example for FileChannel in java NIO

Java Code Example for FileChannel in java NIO
DeeKay September 22, 2011 at 5:59 pm · java.nio

Below is the java code example for FileChannel of java.nio which shows how to use FileChannel to read file.


How to use a FileChannel to read data into a Buffer in java code?

How to use a FileChannel to read data into a Buffer in java code?
DeeKay September 22, 2011 at 5:41 pm · java.nio

Below Java code shows how to use FileChannel to read data into buffer. This is done by following below steps : Create FileInputStream for the file to be read Create FileChannel from FileInputStream Create ByteBuffer as channel reads data into buffer and set the limit of ByteBuffer. Read data from channel to byteBuffer To read…
Continue Reading »


How to use BufferedInputStream: skip() method in java code?

How to use BufferedInputStream: skip() method in java code?
DeeKay September 21, 2011 at 8:46 pm · java.io

Below code shows how to use BufferedInputStream: skip() method in java –


How to use BufferedInputStream: reset() method in java code?

How to use BufferedInputStream: reset() method in java code?
DeeKay September 21, 2011 at 8:39 pm · java.io

Below code shows how to use BufferedInputStream: reset() method in java –


How to use BufferedInputStream: mark() method in java code?

How to use BufferedInputStream: mark() method in java code?
DeeKay September 21, 2011 at 8:24 pm · java.io

Below code shows how to use BufferedInputStream: mark() method in java –


How to use BufferedInputStream: markSupported method in java code?

How to use BufferedInputStream: markSupported method in java code?
DeeKay September 21, 2011 at 8:18 pm · java.io

Below code shows how to use BufferedInputStream: markSupported method in java –


Video Tutorial: How to Implement HttpSessionListener in Java EE (J2EE) ?

Video Tutorial: How to Implement HttpSessionListener in Java EE  (J2EE) ?
DeeKay September 20, 2011 at 11:46 pm · Video Tutorial

Video Tutorial explains How to Implement HttpSessionListener in java EE ( J2EE )


How to Recover MySQL root Password in Linux?

How to Recover MySQL root Password in Linux?
DeeKay September 20, 2011 at 11:30 pm · Linux

To Recover MySQL root password in linux follow below steps – First Stop mysql service. # /etc/init.d/mysqld stop Start MySQL server without password: # mysqld_safe – -skip-grant-tables & Connect to mysql server using mysql client: # mysql -u root Setup new MySQL root user password mysql> use mysql; mysql> update user set password=PASSWORD(“NEW-PASSWORD”) where User=’root’;…
Continue Reading »