Reading a file using FileInputStream

Reading a file using FileInputStream To read a file using FileInputStream in Java, follow these steps: Import the necessary packages:

2. Create a FileInputStream object for the file you want to read:

3. Create a buffer array to store the data you read from the file:

4. Use the read method of … Read more

Concatenating two strings in Java

The + operator can be used for concatenation of strings. concat(String str) is a method of String class that concatenate two strings and return a String.

Basics of Applet in Java

The Java Applet is a special Java program that are primarily used in a internet programming. Applet program runs on a web browser at client side. Applet program are used to make the web site more dynamic. Applet program embedded in a HTML page and hosted on a web server. Applet Skeleton/ Structure Applet skeleton … Read more

indexof and lastindexof Java Examples

indexOf(int ch) returns int value that is the first occurrence of specified character in given string. Counting start from 0. If character not found it returns -1 indexOf(int ch, int fromIndex) returns int value that is the first occurrence of specified character in given string after specified position. If character not found it returns … Read more

Reading title and description of URL using jsoup

This is a sample program to read title and description of specified url. Wh have used java html parser jsoup for this program. for that you have to include jsoup-1.7.2.jar(used in this program). First we have to connect to url using Document doc Jsoup.connect(url).get(); To get title call title() that will return String value String … Read more

High quality thumbnail generation in java

I am generating high quality thumbnail in java for that I am using java-image-scaling High quality image scaling library which is provided under Change license to The BSD 3-Clause License For running this program you have to include java-image-scaling-0.8.6.jar and Filter.jar This is example to generate thumbnail with maintaining aspect ratio

Java Program Structure and First Program

Here we will see the structure of the java program and create a java first program in notepad and run it 1. Structure of Java Program Let’s see the basic structure of the java program 

Here: class- is write to create a class. class_name – is the name of the class. It is an … Read more

double array java- java double array declare initialize access

Double array java is a Java array with double values. All values are stored in contineous memory location Declaring double array in Java General syntax to declare array is dataType [] arrayName; dataType: Any primitive or user-defined data types like int, char, float, double. etc [] : notation to represent an array. arrayName: name of … Read more

Write a program to find greatest number in a 3*3 array

Write a program to find the greatest number in a 3*3 array. The program is supposed to receive 9 integer numbers as command-line arguments. Program to Print 3*3 array in Java Reading 9 integer numbers as command-line arguments and assigning it to 3*3 matrix and printing it Program Steps are Create a Java class declare … Read more

Character Stream I/O in Java

In a java programming, like a Byte stream Character stream is also used for input-output for 16 bit. But Byte streams are used to perform input and output of 8-bit. Most common Character streams classes are, FileReader and FileWriter.  FileReader- FileReader uses for reads two bytes at a time.  FileWriter– FileWriter uses for writes two bytes at a … Read more