Shreyas arya

Generation

generate functionFri, 10 Feb 2023

Create a method print a string If type is not string then throw exceptionand retry 3 times

import java.util.Scanner; public class MyClass { public static void main(String args[]) { Scanner myObj = new Scanner(System.in); System.out.println("Enter username"); String userName = myObj.nextLine(); System.out.println("Username is: " + userName); } }

Questions about programming?Chat with your personal AI assistant