Java Programing laungage

Core Java Tutorial

Introduction of Core Java

How To Install JDk and Set of Path

Syntax of java Program

Difference between Java and C/C++

Advantage and Disadvantage of Java

What is Java

Why Java is not Pure Object Oriented Language

Java has Following Features/Characteristics

Limitation of Java Language and Java Internet

Common Misconception about Java

Simple Program of Java

Integrated Development Environment in java

Compile and Run Java Program

Applet and Comments in Java

Tokens in Java

Keywords in Java

Identifier and Variables in Java


Data Type in Java

Assignments and Initialization in Java

Operators in Java

Rule of Precedence in Java

Operator on Integer and Separators in Java Programming

Java Control Flow of Statements

If and If-else Selection Statement

Nested If-else and If-else-If Selection Statement

switch case and conditional operator Selection Statement

for and while Loop

do..while and for each Loop

break and labeled break statement

continue and labeled continue statement

return Statement and exit() Method

Escape Sequence for Special Characters and Unicode Code

Constants and Block or Scope

Statement in Java

Conversions between Numeric Types in Java

Import Statement in Java

User Input in Java using Scanner Class

User Input in Java using Console Class

Array in Java

One Dimensional Array

Two Dimensional Array

Two Dimensional Array Program

Command Line Argument in Java

String args Types in Java

Uneven/Jagged array in java

Math Class Function and Constant

Math Class all Function used in a program

Enumerated Types in Java

Object Oriented Programming v/s Procedural Programming

Object Oriented Programming Concepts in Java

Introduction to Class,Object and Method in Java

Class Declaration in Java

Class & Objects in java

Encapsulation in Java

Modifiers/Visibility for a Class or Interrface or member of a Class

Polymorphism in Java

Runtime polymorphism (dynamic binding or method overriding)

java.lang.String package and its all method

Java, like most programming languages, allows you to use the + sign to join (concatenate) two strings together.

Previous Home Next


//Example for String Concatenation
public class StringDemo {
public static void main(String args[]) {
String s1= new String("He is a man");
String age = "15 year old";
System.out.println(s1.toString()+ " and " + age);
 //here String is Concatenation


  He is a man and 15 year old
String Conversion using toString( ) method.

In String toString()method is used for the Conversion of the String. Java converts data into its string representation during concatenation, it does so by calling one of the overloaded versions of the string conversion method valueOf( ) defined by String.


Java.lang.String package

In Java package is default java.lang.String package it is subpackage of java.lang contain all the String class and method .The String class in Java contains more than 50 methods.

String Method whose mostly used

  • char charAt(int index): returns the character at the specified location.
  • int compareTo(String other): returns a negative value if the string comes before other in dictionary order, a positive value if the string comes after other in dictionary order, or 0 if the strings are equal.
  • boolean endsWith(String suffix): returns true if the string ends with suffix.
  • boolean equals(Object other) returns true if the string equals other.
  • boolean equalsIgnoreCase(String other): returns true if the string equals other, except for upper/lowercase distinction.
  • int indexOf(String str)
  • int indexOf(String str, int fromIndex): return the start of the first substring equal to str, starting at index 0 or at fromIndex.
  • int lastIndexOf(String str)
  • int lastIndexOf(String str, int fromIndex) return the start of the last substring equal to str, starting at index 0 or at fromIndex.
  • int length(): returns the length of the string.
  • String replace(char oldChar, char newChar): returns a new string that is obtained by replacing all characters oldChar in the string with newChar.
  • boolean startsWith(String prefix):returns true if the string begins with prefix.
  • String substring(int beginIndex)
  • String substring(int beginIndex, int endIndex): return a new string consisting of all characters from beginIndex until the end of the string or until endIndex (exclusive).
  • String toLowerCase(): returns a new string containing all characters in the original string, with uppercase characters converted to lower case.
  • String toUpperCase(): returns a new string containing all characters in the original string, with lowercase characters converted to upper case.
  • String trim(): returns a new string by eliminating all leading and trailing spaces in the original string.
Previous Home Next