java

Test an exception with Testng

Tag(s):

package net.xngo.tutorial.java.testng;
 
import static org.testng.Assert.assertTrue;

Simplest way to output "Hello world" using SLF4J

package net.xngo.tutorial.java.slf4j;
 
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
 

List all files and ignore symbolic links

package net.xngo.tutorial.java.apache.commons.io;
 
import java.io.File;

Read byte stream

Tag(s):

package net.xngo.tutorial.java.io;
 
import java.io.FileInputStream;
import java.io.InputStream;
 

Install JAVA 7

Tag(s):

apt-get -y install openjdk-7-jre
# or

Use of generic type

Tag(s):

package net.xngo.tutorial.java.lang;
 
/**
 * Show use of generic type.
 * http://docs.oracle.com/javase/tutorial/java/generics/types.html
 * http://www.oracle.com/technetwork/articles/java/juneau-generics-2255374.html
 * @author Xuan Ngo
 *
 */

JCommander basic

package net.xngo.tutorial.java.jcommander;
 
import com.beust.jcommander.JCommander;

Unit test standard output, System.out.println

Tag(s):

package net.xngo.tutorial.java.testng;
 
import java.io.ByteArrayOutputStream;
import java.io.PrintStream;

Why File.createTempFile() does physically create an empty file on the hard drive?

Tag(s):

Why File.createTempFile() does physically create an empty file on the hard drive? To reserve the filename as being unique. Otherwise, there is a possibility that another file with the same name could be created by another process.

Pages

Subscribe to RSS - java