Ask a Question
Ask Question Login
Corporate Training
  1. Community
  2. Ricki Griffen

Ricki Griffen

Community Learner
Share
4Questions
3Answers
6.5KViews on questions

Scanner is skipping nextLine after using next or nextFoo

The problem is with the input.nextInt() method - it only reads the int value. So when you continue reading with input.nextLine() you receive the " " Enter key. So to skip this you have to add the input.nextLine(). Hope this should be clear now. Try it like that: System.out.print("Insert a number: "); int number =…

Java

Answered Jul 26, 2021 · 1.4K Views Read answer →

How to cast an Object to an int?

Assuming the object is an Integer object, then to cast an object to int you can do this: int i = ((Integer) obj).intValue();If the object isn't an Integer object, then you have to detect the type and convert it based on its type.

Devops

Answered Jul 18, 2021 · 1.7K Views Read answer →

More members from the DevOps community

Learners asking and answering questions on the same topics — follow their questions and join in.

Latest DevOps Blogs

Guides, tips and career advice on DevOps from JanBask experts.

Learn & Explore

Free tutorials and interview questions from industry experts — learn the skill, then get ready to prove it.