The following example illustrates reversing words and letters in a string. This is in fact a Google interview question and now it's sol...
Read More
Home » Archive for 2012
Difference Between Capacity() And Size() In Vector
The difference between capacity() and size() in java.util.Vector is that capacity() returns how many elements it can store whereas the size...
Read More
Binary Search For Integer In Array
The following example illustrates binary search of int in array. import java.util.*; class SearchInt { public static void main...
Read More
Using Windows Look And Feel For Jbutton
An example on using WindowsLookAndFeel for JButton import javax.swing.*; import java.awt.*; class WindowsButton extends JFrame { JPane...
Read More
Varargs With Multiple Parameters
The following example illustrates varargs with multiple parameters. class MultipleParam { public static void main(String args[]) { s...
Read More
Varargs In Java Tutorial For Beginners
In Java varargs is a unique concept. This tutorial helps students learn varargs (variable arguments) in Java in an easy way. Let us learn a...
Read More
Varargs For String In Java
The following example illustrates Varargs for String using a simple static method in for easy understand class VarArgsExample { ...
Read More
Varargs For Integer In Java
An example on using single variable arguments for int in Java. class VarArgsIntExample { public static void main(String args[]) ...
Read More
Set Hand Cursor For Jbutton
An example on setting hand cursor for JButton in Java. Example import javax.swing.*; import java.awt.*; class HandCursorButton { pub...
Read More
Multiply Elements In Array
An example on multiplying all elements in array in Java. Example class MultiplyElements { public static void main(String args[])...
Read More
Using Log() And Log10() In Strictmath
An example on using log() and log10() in StrictMath class. import java.util.*; class FindLog { public static void main(String args[])...
Read More
Reverse Digits Of Integer In Java
An easy example on reversing digits of an integer in Java using convert and do. Example import java.util.*; class ReverseDigits { ...
Read More
Concat More Than 2 Strings In Java
A simple logic to concat more than 2 (unlimited) no.of strings in Java. Here is the piece of code. Concat Unlimited Strings - Example ...
Read More
Get File Separator In Java
An example on getting file separator thereby detecting the OS approximately. Single statement. File Separator Example import java.io.*;...
Read More
List All Local Drives In Java
An example on getting paths of all local drives in a computer in Java. Get Local Drive Paths - Example import java.io.File; class GetL...
Read More
Search File In Java Recursively
An example recursive logic on searching file like windows search in Java. This logic is much similar to the logic used in deleting folder i...
Read More
Get Windows Directory In Java
A single line of code to get Windows (System directory) of your PC folder path in Java. Get Windows Directory class GetWindowsDir { ...
Read More
Get Java Installation Directory In Java
Single statement to get the directory where Java is installed in your computer. Java Installation Directory class JavaInstallationD...
Read More
Get Operating System Name In Java
Single statement is enough for getting OS name in Java. So simple. Get OS Name class OSName { public static void main(String a...
Read More
Subtract Elements In Array In Java
An example code on subtracting elements in array in Java in decreasing order in 3 main steps. This simple logic can also be used on any pro...
Read More
Sort Array In Increasing Order In Java
An example code on sorting an array of (any numeric datatype) in increasing order in a single statement. Sorting Array in Increasing ...
Read More
Add All Elements In Array In Java
An example on adding all the elements in an array that user gives. A really simple logic involving 2 main steps. Add all Elements in Arr...
Read More
Stringtokenizer In Java Example
An example on using java.util.StringTokenizer for counting no.of tokens split by a delimeter, using the methods hasMoreTokens() , nextToke...
Read More
Java Code To Play Mp3 File
An example code on playing not only mp3 but any audio file in Java in just 2 statements. Your first step to create an audio player. Inst...
Read More
Split String By Length In Java
An example on splitting a string after 'n' characters i.e. into chunks with n characters each in Java. Let's Split im...
Read More
Set Classpath In Java Permanently
Setting classpath is the most essential part that every Java starter has to know because not just Java gives the developer the capability t...
Read More
Capitalize A String In Java
An example on making the characters after the space capital if they are not, in Java. Here is a logic that i've written and that's ...
Read More
Subscribe to:
Posts (Atom)