Skip to content

Commit 0fdcc2f

Browse files
authored
Create String.java
1 parent 0387757 commit 0fdcc2f

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

String.java

+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
public class Stringg
2+
{
3+
public static void main(String[] args)
4+
{
5+
String s1 = "Hello"; //creating string by java string literal
6+
char ch[] = {'J','A','V','A'};
7+
String s2 = new String(ch); //converting char array to string
8+
String s3 = new String("Program"); ////creating java string by new keyword
9+
System.out.println(s1);
10+
System.out.println(s2);
11+
System.out.println(s3);
12+
}
13+
}

0 commit comments

Comments
 (0)