Introduction to Strings

 package com.company;

import java.util.Scanner;

public class tuts {
public static void main(String[] args) {
String word = new String("infinite");
float a = 3.14f;
// String word = "infinite";

System.out.printf("The value of Pie is %s but for calculations it it taken as %f.",word, a);
System.out.println("Enter text: ");
Scanner sc = new Scanner(System.in);
String input = sc.nextLine();
System.out.println(input);

}
}

Comments

Popular posts from this blog

Creating a Thread by Extending Thread class

Constructors from Thread class in Java