Course Hive
Search

Welcome

Sign in or create your account

Continue with Google
or
User input in Java is easy! ⌨️
Play lesson

Java tutorial for beginners ☕ - User input in Java is easy! ⌨️

5.0 (4)
40 learners

What you'll learn

This course includes

  • 12 hours of video
  • Certificate of completion
  • Access on mobile and TV

Summary

Keywords

Full Transcript

#java #javatutorial #javacourse import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner scanner = new Scanner(System.in); System.out.println("Enter your name: "); String name = scanner.nextLine(); System.out.println("Enter your age: "); int age = scanner.nextInt(); System.out.println("What is your gpa: "); double gpa = scanner.nextDouble(); System.out.println("Are you a student? (true/false): "); boolean isStudent = scanner.nextBoolean(); System.out.println("Hello " + name); System.out.println("You are " + age + " years old"); System.out.println("Your gpa is: " + gpa); if(isStudent){ System.out.println("You are enrolled in classes"); } else{ System.out.println("You are NOT enrolled in classes"); } scanner.close(); } }

Course Hive

Continue this lesson in the app

Install CourseHive on Android or iOS to keep learning while you move.

Related Courses

FAQs

Course Hive
Download CourseHive
Keep learning anywhere