You are here: Home / Topics / Simple string example in Java

Simple string example in Java

Filed under: Java on 2023-08-23 06:55:35

// Program to explain the following String function :
// String( String strObj )

class  MString11
{
public static void main( String args[ ] )
{
 String s1 = "Nils : " + 5 + 5; 
 String s2 = "Nils : " + (5 + 5);

 System.out.println( s1 );
 System.out.println( s2 );
}
}


Output:

Nils : 55
Nils : 10

 

About Author:
J
Java     View Profile
Hi, I am using MCQ Buddy. I love to share content on this website.