3. Write a program to print your school name and your class teacher’s name on a single line. Assign your school name to a variable SN and your class teacher’s name to another variable TN . About the author Adalynn
Here is the java program for it — note-import the command is used outside the main class import java.util.Scanner; //inside the main class Scanner sc = new Scanner(System.in); System.out.print(“Enter your school name: “); String SN = sc.next(); System.out.println(“Enter your class teacher name: “); String TN = sc.next(); System.out.println{“Your school name is “+ SN+ “Your teacher\’s name is “+ TN); hope u like it and if it’s a paper and u only need name then remove the first two print lines and in the last print line changes are System.out.println{ SN+” “+TN); Reply
Here is the java program for it —
note-import the command is used outside the main class
import java.util.Scanner;
//inside the main class
Scanner sc = new Scanner(System.in);
System.out.print(“Enter your school name: “);
String SN = sc.next();
System.out.println(“Enter your class teacher name: “);
String TN = sc.next();
System.out.println{“Your school name is “+ SN+ “Your teacher\’s name is “+ TN);
hope u like it and if it’s a paper and u only need name then remove the first two print lines and in the last print line changes are
System.out.println{ SN+” “+TN);