Java Basic
AllEvenNum
under the java.io package. java.io
package.java.io
package.java.io package.Link
List Example in Java
In this example we are going to show the use of java.util.LinkedList
class. You will be creating an object of link list class and performing
various operation like adding and removing object.
Listing
the File System Roots
In this example we will list out all the drives in the disk. this
requires an array of File class where all the drives will get stored
by using only one method.
Reading
a File into a Byte Array
In this program we will read a file in the form of a byte array. We
can do it very easily. Firstly we will create an object of File class
and pass the name of the file which we want to read, in the constructor of File
class. We will use DataInputStream to read primitive data types.
Implementing
a Serializable Singleton
In Singeton classes only one instance will be created. We are going
to serialize the class. This can be done very easily. What we need to do is
to implement a java.io.Serializable interface. We will use a
method of Serializable interface that is readResolve().
Example
of Java Stack Program
Stack is like a bucket we you can enter objects and retrieve it.
Here in the example describes the methods to prepare an example of Java
stack program. The Stack class represents a
last-in-first-out (LIFO) stack of objects. It extends class Vector
and implements Cloneable, Collection, List, Serializable interfaces.
We mostly use push and pop operations.
Add two big numbers
In this section, you will learn how to add two big
numbers. For adding two numbers implement two big decimal numbers then apply the Sum() method that takes both numbers.
String Buffer insert and append example
In this section, you will learn how to insert StringBuffer
and append data. The StringBuffer is a class that implements multiple
sequence of characters. The following program construct a string buffer that has
'0' capacity.
Character Comparison Example
In this section, you will learn how to compare
characters in Java. The java.lang package provides a method for comparing
two case sensitive strings. The compareTo()
method compares two strings on the basis of Unicode of each character of the given
strings.
Comparison character cases
ignoring case sensitiveness in
java
In this section, you will learn how to compare two strings
ignoring case sensitiveness Java provides the method that ignores
cases, it only compare the character's sequence. The compareToIgnoreCase()
method compares two strings and ignores its cases.
Combine String example
In this section, you will learn how to combine or merge
two strings in java. The java.lang package provides the method
that helps you to combine two strings and making into single string.
Compare string example
In this section, you will learn how to compare two
strings in java. The java lang package provides a method to compare two
with their case either upper and lower. The equals()
method provides the facility of comparing the two strings.
Replace Character in String
This example replaces a character with a specified character in a given
string.
Convert String to a float
In this section, you will learn how to convert string
data into a float type data. The java.lang package provides the
method that converts string data into float and also converts it into double.
Convert integer type data into binary, octal and
hexadecimal
In this section, you will learn how to convert an
integer type data into binary, octal and hexadecimal. The java.lang package
provides the facility for converting the data integer into binary, octal, and
hexadecimal.
Round two decimal places
In this section, you will learn about how to round the
figure up to two decimal places in java.
String length example
In this section, you will learn how to get the length
of given string. The lang package of java provides the facility for getting
the length of string. You will see in the following program for getting the
length of string by using the length() method that returns integer type
value of any given string
Trim String Example
In this section, you will learn how to remove the blank
spaces. For removing the blank spaces use trim()
method that removes the blank spaces and shows only string.
String Start with Example
In this section, you will learn how to check the given
string that start from the specified character in java. The following program checks
the started string with "Wel".
String End with Example
This section tells you, how to determine the given
string ends with specified string. The following program helps you to check whether the given string starts with the specified string is true or false by applying
endsWith() method and returns Boolean types values either 'true' or 'false'.
Passing Command Line Arguments
In this example we are going to learn how we can
pass values on command line argument .
Decimal Format Example
In this example we are going to format
a decimal value.
Delay Example
In this section we learn how we can
make a program so that there are delay between the execution of program.
Line Number
Reader Example
In this example we are reading
number of lines.
Operating System Information
In this example we are learn how we can get
information about our operation system. In this example we are getting the
OS name, its version and architecture of OS. We are using getProperty(String
key) to get the property of the OS.
Taking
Substring
In this example we are taking a sub string from a given string.
Find Current Temp
Directory
In this
example we are find the current Temp directory.
Find User Home Directory
In this
example we are find user home directory.
Write Text into File
In this example we are writing text
into file. In this example we are initialize string to write into file. We
are creating file in which we are writing string by use of write()
method.
Access Static
Member Of The Class Through Object
Static methods are special type of methods that work
without any object of the class. Static methods are limited to calling other static
methods in the class and to using only static variables.
Command Line Arguments in Java Program
Java application can accept any number of arguments
directly from the command line. The user can enter command-line arguments when
invoking the application.
Read a string
and reverse it and then print in alphabetical order.
A string is a contiguous sequence of symbols or values,
such as a character string (a sequence of characters) or a binary digit string
(a sequence of binary values).
Java Arrays
Tutorial
Java Arrays Tutorials and examples .
Java String Split Example
In this section, you will learn how to split string into different parts
using spit() function.
If you are facing any programming issue, such as compilation errors or not able to find the code you are looking for.
Ask your questions, our development team will try to give answers to your questions.
Ask Questions? Discuss: Beginners Java Tutorial View All Comments
Post your Comment