You are on page 1of 2

/*

* To change this license header, choose License Headers in Project Properties.


* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package stringoperations;
/**
*
* @author pc
*/
public class Stringoperations {
/**
* @param args the command line arguments
*/
public static void main(String[] args) {
String string2="world";
String string3="";
string3="hello".concat(string2);
System.out.println("string3 :"+string3);
System.out.println("length: "+string2.length());
System.out.println("substring: "+string3.substring(0,5));
System.out.println("uppercase: "+string3.toUpperCase());
// TODO code application logic here
}
}
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package switching;
/**
*
* @author pc
*/
public class Switching {
/**
* @param args the command line arguments
*/
public static void main(String[] args) {
// TODO code application logic here
}
}
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package switchstringapp;
/**
*
* @author pc

*/
public class Switchstringapp {
/**
* @param args the command line arguments
*/
public static void main(String[] args) {
// TODO code application logic here
}
}
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package switchstringstatements;
/**
*
* @author pc
*/
public class Switchstringstatements {
/**
* @param args the command line arguments
*/
public static void main(String[] args) {
String color="blue";
String shirt="Shirt";
switch(color)
{
case "blue":
shirt="blue"+"shirt";
break;
case "red":
shirt="red"+"shirt";
break;
default:
shirt="white"+"shirt";
}
System.out.println("Shirt type:"+ shirt);
// TODO code application logic here
}
}

You might also like