How to Create a String in Java


In this example, we will learn the method to create a string in Java.

Source Code

package com.beginner.examples;

public class CreateString {
  public static void main(String[] args) {
    String s = "ok"; // String
    System.out.println(s);
  }
}

Output:

ok
Subscribe
Notify of
guest
0 Comments
Inline Feedbacks
View all comments