Posts

Showing posts from January, 2017

Java Applet

Image
What is a Java applet? A Java applet is a small application which is written in Java and delivered to users in the form of bytecode. The user launches the Java applet from a web page, and the applet is then executed within a  Java Virtual Machine  ( JVM ) in a process separate from the  web browser  itself. What is the difference between application and applet? An  applet  is a  program  written in the Java programming language that can be included in an HTML page, much in the same way an image is included. An application  is a standalone Java  program  that runs as a true  application , outside of a browser. Both require a JVM (Java Virtual Machine). Advantage of Applet There are many advantages of applet. They are as follows: It works at client side so less response time. Secured It can be executed by browsers running under many platforms, including Linux, Windows, Mac OS etc. Drawback of Applet Plugin is required at client browser t

68th Republic Day (26 January 2017)

Image
Happy Republic Day

Split String in Java

Split String in Java You can split a String by whitespaces or tabs in Java by using the   split()   method of   java.lang.String   class. This method accepts a regular expression and you can pass a regex matching with whitespace to split the String where words are separated by spaces. This java program has demonstrated to split a String by single or multiple whitespaces or tabs in Java. Program: import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; public class StringSplitDemo {        public static void main(String[] args ) {               // TODO Auto-generated method stub               String line ;               String[] words ;               BufferedReader reader = new BufferedReader( new InputStreamReader(                            System . in ));                             System . out .println( "input string words separated by space: " );                           try {