You are on page 1of 2

Chapter 8 - String Processing in Java

Topics
-Command Line Arguments
-Properties file
-String split() method
-StringTokenizer class
-Pattern Matcher

-----------------------------------------------------------------------------------
---------------------------

Command Line Arguments


public static void main(String[] args)
{}

here String[] args is called as command line arguments

Demo1: Using Notepad


Demo2: Using Netbeans

To compile - javac filename.java


To run - java filename arg1 arg2 arg3....

-----------------------------------------------------------------------------------
---------------------------

Properties file:

-stores data in a key-value pair inside a file


-extension of file is .properties
- predefined class in java.util package

Question: I want to store my id and name in a properties file. then read it from my
java application, and display to the user.

-----------------------------------------------------------------------------------
---------------------------

String split() method

String.split(", ");
asking comma and space

Question. I want to store some names inside a string variable, then display it
using split() method

-----------------------------------------------------------------------------------
---------------------------

StringTokenizer class:
-predefined class in java.util package
-does same work as String.split() method

Question. I want to store some names inside a string variable, then display it
using StringTokenizer class
(", ");
asking comma or space

You might also like