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

Literals/Constants

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)

String Concatenation using String Conversion.
Previous Home Next

Example

//Example for String Conversion And String Concatenation
package r4r.co.in;
import javax.swing.*;
public class StringDemo {
public static void main(String[] args) {
String name = JOptionPane.showInputDialog("Enter your name?");    
//Enter first input(name)
String input = JOptionPane.showInputDialog("Enter your Age?");     
//Enter second input(Age)
int age = Integer.parseInt(input);   
//String Conversion string to integer value
// String Concatenation and display output on console.
System.out.println("Hello,Dear " + name + ". Next year, you'll be " + (age + 1));
//Terminates the currently running Java Virtual Machine, and return abnormal termination.
System.exit(0);
    }
}

Output:

 Hello,Dear Rajesh. Next year, you'll be 25.
Login Application in String (Using BufferReader Class)
//Login Application in String
package r4r.co.in;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
public class loginApplication {
public static void main(String[] args) throws IOException {
String s1 = new String("r4r@techsoft.com");
String s2 = new String("r4r");
System.out.println("Username:" + s1.toString() + "\nLength: " + s1.length());
 //Used String Concatenation 
System.out.println("Password:" + s2.toString());
BufferedReader br1 = new BufferedReader(new InputStreamReader(System.in)); 
//BufferedReader class is used for input the value
System.out.println("Enter your Username:");
String st1 = br1.readLine();
System.out.println("Your username:" + st1.toString());
BufferedReader br2 = new BufferedReader(new InputStreamReader(System.in));
System.out.println("Enter your Password:");
String st2 = br2.readLine();
System.out.println("Your username:" + st2.toString());
try {
    if (s1.equals(st1) && s2.equals(st2)) {  //String Comparison  match
System.out.println("Authentication persion:Welcome to R4R");
    } else {
System.out.println("Invalid Username And Password");
    }
} catch (Exception e) {
    System.out.print(e);
}
    }
}

output:

Username:r4r@techsoft.com
Length: 16
	  //length can be estimated by using length() method
Password:r4r
Enter your Username:
r4r@techsoft.com     
	  //Enter name using BufferReader
Your username:r4r@techsoft.com
Enter your Password:
r4r
Your username:r4r
Authentication persion:Welcome to R4R  
Previous Home Next