How to Print a String in Java

The Program will asked user to enter something and after this display the same story on the screen. To print something on the screen we used System.out.print function in java.

Source Code

package javaapplication85;
import java.util.Scanner;

public class string_fun {
public static void main(String[] args) {
    Scanner input = new Scanner (System.in);
    String sen = "";
    System.out.println(" Enter Your Story ");
    sen = input.nextLine();
    System.out.println(" Your Story is " +sen);
   }
  }

Output of the Program

Java String

Share on Google Plus

About Asad

Asad Niazi is Software Engineer , Programmer, Web Developer and a young mentor of BloggersTown and PProgramming. Asad Love to writes about Technology, Programming, Blogging and make money online.
    Blogger Comment
    Facebook Comment

0 comments:

Post a Comment