• Share
  • Email
  • Embed
  • Like
  • Save
  • Private Content
5. java array & string
 

5. java array & string

on

  • 227 views

5. java array & string, argus academy, ranchi

5. java array & string, argus academy, ranchi

Statistics

Views

Total Views
227
Views on SlideShare
227
Embed Views
0

Actions

Likes
0
Downloads
10
Comments
0

0 Embeds 0

No embeds

Accessibility

Upload Details

Uploaded via as Microsoft PowerPoint

Usage Rights

© All Rights Reserved

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Processing…
Post Comment
Edit your comment

    5. java array & string 5. java array & string Presentation Transcript

    • JAVA by ArguS academy
    • In Java string is a sequence of characters. Java implements string as a object type of string. In java string are more reliable and predictable. We know that in C/C++ string terminate with null character but in java string is not terminated. It means we can insert and append string in existing string. In java string are class object and implemented using two class namely string & stringBuffer classes. Both string & stringBuffer classes are defined in java.lang
    • public class st { public static void main (String r[]) { char a[]={'a','r','g','u','s'}; String a1="argus"; String a2=new String ("ArguS"); String a3=new String (a1); byte a4[]={65,66,67,68,69,70}; String a5=new String (a4,2,2); String a6=a2.concat(a5); String a7=a6.concat("f"); System.out.print(a1+a2+"5"+a3+a5+a6+a7); System.out.print(a2.length()); System.out.print(a2.charAt(2)); System.out.print(a2.toLowerCase()); System.out.print(a2.toUpperCase()); System.out.print(a2.trim()); System.out.println(a1+a2+"="+a1.equals(a2)); System.out.print(a1+a2+"="+a1.equals(a3)); System.out.println(a1+a2+"="+a1.equalsIgnoreCase(a2)); System.out.print(a1+a2+"="+a1.compareTo(a2)); System.out.print(a1+a2+"="+a1.compareToIgnoreCase(a2)); } }
    • TO INPUT SERIES OF STRING import java.util.*; public class dd { public static void main(String[] args) { Scanner n1=new Scanner(System.in); String st1[]=new String[3] ; int i,k=3; for(i=0;i<k;i++) { st1[i]=n1.nextLine(); } for(i=0;i<k;i++) { System.out.println(st1[i]); } } }