Question: need Help to tweak this to get it to work import java.util.Scanner; // Import the Scanner class public class MidTermBurt { private static Scanner myObj;
need Help to tweak this to get it to work
import java.util.Scanner; // Import the Scanner class
public class MidTermBurt {
private static Scanner myObj; public void printLine(int n) {
// The function takes n as parameter which is the length of the line // we want to print. for (int i = 0; i < n; i++) { System.out.print("*"); }
// The return type of the method is "void" }
public static void main(String[] args) {
myObj = new Scanner(System.in);
// Getting string from the User String myStr = myObj.nextLine();
// Using charAt string method to get the character at a particular position in // string if (myStr.length() > 0) { // If statement using the length of the string check whether it is greater than // 0 System.out.println("The input string is: " + myStr); } else { System.out.println("The input string is very less as space"); }
for (int i = 0; i < 10; i++) { // We initiated i value as 0 and iterating till i reaches 10
System.out.println("Hi"); // Generates message on the Screen }
// Tester utilizing the printLine function to print line based on some number String obj1 = "Junit"; String obj2 = "Junit"; obj1.equals(obj2); // This is assert method usage...
}
}
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
