Quantcast
Channel: Search Results For: domain:java-demos.blogspot.in
Browsing latest articles
Browse All 23 View Live

Image may be NSFW.
Clik here to view.

Struts Folder Structure for Tomcat

A simple demonstration on the Struts folder structure for Apache Tomcat 5/6/7 whatever the version may be.

View Article



Image may be NSFW.
Clik here to view.

Using isAlive() and join() with threads

Using isAlive() and join() with Threads in Java Multi Threading in a simple and a easy way.

View Article

Image may be NSFW.
Clik here to view.

charAt Java - Using charAt(int) in java.lang.String

charAt Java: This tiny method in Java looks tiny, but does a great job. Yes! just compare it with the logic that we have done in C Programming, how is it do this? Oh My God!, but now Java, our friend...

View Article

Image may be NSFW.
Clik here to view.

Java Delete a Folder - Delete All the Files in a Folder - A Smart Way

Java Delete a Folder: One of the easiest ways to delete a folder is to apply a smart logic. When you have got it into an idea, you will have to immediately recall that it is 'repeat' what can do the...

View Article

Image may be NSFW.
Clik here to view.

String To Byte Array - Convert String To Byte Array using getBytes()

String To Byte Array: As seen in String To Char Array post i have previously written, now the same thing, i.e. a string can be converted to byte array easily using the getBytes(). This method returns...

View Article


Image may be NSFW.
Clik here to view.

Set Background Image to JMenuBar

This illustrates setting background image to JMenuBar. For this we need to paint an background image on JMenuBar. 1 main step is far from background image.

View Article

Image may be NSFW.
Clik here to view.

Remove Duplicate Elements in a Vector

Vector in java.util package is used as a dynamic array. Any no.of elements can be added to the vector. It might be essential sometimes to remove duplicate elements in the vector to save space. While...

View Article

Image may be NSFW.
Clik here to view.

The For Each Loop in Java

Let us talk about For Each Style loop in Java. One of the most beautiful feature of the Java core.

View Article


Image may be NSFW.
Clik here to view.

Using Lambda Expressions in Threading

Let us now see how to use lambda expressions in multi threading in Java. The aim of the Project Lambda in the Java 8 is to make the programmers easy to code the anonymous methods. The following example...

View Article


Image may be NSFW.
Clik here to view.

Using java.net.URLConnection class in Networking

The java.net.URLConnection class establishes a link between your Java program and a resource on the network, a URL. Here is a program on how we can get various details regarding a URL such as it's...

View Article

Image may be NSFW.
Clik here to view.

How to open JNLP files in Windows?

For many days, in fact months i was unable to open a JNLP file and just now i came to know how to do it? In this moment, i would like to share how i opened a JNLP file in my Windows computer.

View Article

Image may be NSFW.
Clik here to view.

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.

View Article

Image may be NSFW.
Clik here to view.

Compare two strings in Java lexicographically

The compareTo(T ob) method in the Comparable class is implemented in the String class and this implemented method takes java.lang.String as parameter. This method compares two strings...

View Article


Image may be NSFW.
Clik here to view.

Cookies in Servlets with Example

The following tutorial brings you an understanding of how-to use cookies in Java servlets, one of the interesting and important concepts to go around. In this post, i'll explain about cookies...

View Article

Image may be NSFW.
Clik here to view.

Pre Check web.xml for Errors in Servlets

Sometimes we might be disgusted when we encounter errors related to web.xml while executing our web application, we might not understand it at times even when we look at the Tomcat logs. So in this...

View Article


Image may be NSFW.
Clik here to view.

Get last digit in a number

Let me illustrate a very simple logic on getting last digit of a number. The logic is applicable on any programming language and not just in Java. As this is a Java demos blog, I am likely to code it...

View Article

Image may be NSFW.
Clik here to view.

Installing Spring Framework in Windows

Here is a simple tutorial on installing and configuring Spring Framework. This is very simple that you'll just laugh at it. All you need to do is to just set the classpath for two jar files and that's...

View Article


Image may be NSFW.
Clik here to view.

Get item after the array is used up 'n' times

Sometimes we may encounter a question like, if there are 5 colors and every color is picked up by a student in order and if 72 students pick colors in order one after the other, then what is the color...

View Article

Image may be NSFW.
Clik here to view.

Hello World Example in JSP with Explanation

Before we have seen how to swap two variables with the use of temp. Now, it's time to see how to swap two variables without the use of a temporary variable. This is just easy if you take a look. It is...

View Article

Image may be NSFW.
Clik here to view.

How to Convert ArrayList into Array

Here is a question about converting ArrayList to an array. We can do this using two simple methods in the java.util.ArrayList. These methods return the Object[] which can be typecasted. Here are two...

View Article

Image may be NSFW.
Clik here to view.

Copy 1D Array to 2D Array Easily

In this example, i'll show you how to copy a 1-D array into 2-D array in Java. Here is a simple logic that does the task. The task is to create a matrix of certain number of rows and columns which will...

View Article


Image may be NSFW.
Clik here to view.

How to reverse elements in Array

The following illustrates reversing elements in an array using the common swapping technique. The logic is dead simple and is considered to be of easy to medium difficulty. In this I will provide an...

View Article


Image may be NSFW.
Clik here to view.

How to delete a file through JFileChooser

Like the AWT FileDialog, JFileChooser unfortunately did not have a feature to delete the file upon delete. Here is a simple hack that you can do to delete a file when the delete button is pressed.

View Article
Browsing latest articles
Browse All 23 View Live




Latest Images