Step 1: Declare Variables.
String s1, s2, s3;
Step 2: Initialise all the variables to a value using = operator.
s1 = s2 = s3 = "Hello";
package com.sample.app;
public class App {
public static void main(String args[]) {
String s1, s2, s3;
s1 = s2 = s3 = "Hello";
System.out.println("s1 = " + s1);
System.out.println("s2 = " + s2);
System.out.println("s3 = " + s3);
}
}
Output
s1 = Hello
s2 = Hello
s3 = Hello
You may
like
No comments:
Post a Comment