Skip to main content
Filter by
Sorted by
Tagged with
0 votes
0 answers
33 views

I’m learning Java and testing basic input handling. I wrote the following simple program: import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner ...
Burak HINGE's user avatar
0 votes
0 answers
75 views

I wrote some simple Java code to take input from the console (using Eclipse 2016 IDE) to assist with iterating through a text file and outputting a file in SWIFT MT940 statement structure. For the ...
GuzziTony's user avatar
0 votes
0 answers
31 views

Hi I'm trying to learn java This a simple program that stores a patient's blood details, well in any case how can i keep the program accurate by means of returning an error message if the input was ...
Annika's user avatar
  • 1
0 votes
0 answers
39 views

what is the problem with my code and why do I have the InputMismatchException error every time I type the name in the console ? Scanner sc = new Scanner(System.in); System.out.println("...
Vincent's user avatar
0 votes
1 answer
33 views

I was given an exam, where I had to create a class and after that, I had to write two functions in which the input parameter is an object Array and took the values from user input. Below is the code ...
Vishal's user avatar
  • 23
0 votes
1 answer
95 views

"Eclipse IDE for Java Developers (includes Incubating components) Version: 2023-03 (4.27.0)" Intro to Programming using Java Section 3.5.3 Sorry for the very long post. This is my first post ...
whiteTreaty's user avatar
0 votes
0 answers
49 views

Having successfully created a policy holder and writing the information to csv I try to run the program again using a do while loop but receive an inputmismatchexception after typing surname. Can ...
donkey_junior's user avatar
0 votes
2 answers
303 views

The goal is to make code that can handle exceptions and keep going. I made a try/catch for typing string instead of numbers, but when I test it, it prints the catch output but then has these errors : ...
Sami Danielson's user avatar
-1 votes
2 answers
4k views

Given the MileageTrackerNode class, complete main() in the MileageTrackerLinkedList class to insert nodes into a linked list (using the insertAfter() method). The first user-input value is the number ...
Dawgbizkit83's user avatar
0 votes
0 answers
19 views

I am getting the input mismatch exception error on my code. I am getting error at the Engine displacement line. Scanner scanner = new Scanner(System.in); Car[] arr; System.out.println(&...
Aishwary Singh's user avatar
0 votes
2 answers
31 views

I am a newbie with java and the class scanners. I have two Codes and I dont get the point why one of them throws a InputMismatchException. I look forward to the answers. Here both codes: 1st one with ...
InfinityLoop's user avatar
0 votes
2 answers
388 views

The question is: Create a class person with attribute name, age and gender. Create an array of the person to hold 10 person instances. Display the information stored on the person instance in the ...
Lekh Raj Awasthi's user avatar
0 votes
1 answer
29 views

Here is my problem I've been struggling with: I want the input to be in this form: 1 So I wrote the code like this. Unfortunately, it either gives me an InputMismatchException at line 6 or cannot ...
Tina's user avatar
  • 13
2 votes
2 answers
388 views

Problem I was messing around with Java today, and bumped into something that I can't fix by myself. I'm trying to get a double value from scanner but always get this error: Exception in thread "...
Yashmerino's user avatar
0 votes
1 answer
69 views

I'm trying to read the highscores of a game from a txt file and put them into an array so that another section of the program can detect a high score. Earlier I had everything declared as Int and it ...
Guido's user avatar
  • 1
0 votes
1 answer
616 views

I'm working on a project and I already finished it, I have really simple problem which makes me really confused. I'm trying to ask a user to enter a number from a menu and depending on that different ...
Infernalissss's user avatar
0 votes
4 answers
3k views

Im currently trying to build a code that prevents wrong user input (storing a char/string to a integer, e.g.) but Im not being able to make it to work... public static void main(String[] args) { ...
Agustin's user avatar
0 votes
1 answer
62 views

I'm trying to catch InputMismatch exceptions and display a message that tells me where the exception occurred and what type of input is required. I need this to loop until the correct input is entered....
timestopMachinist's user avatar
0 votes
1 answer
29 views

My InputMismatchException isn't working, as when I put in something like a double into the input, instead of the exception output message, it gives me: Exception in thread "main" java.lang....
gino's user avatar
  • 41
-1 votes
1 answer
93 views

I'm trying to read a .adi file that has a line format of String, Int and Double. For example: Ford,Fusion,2010,85254,12855.58 For the code, I'm required to use a try-catch statement and the method ...
Havanna Ransom's user avatar
0 votes
2 answers
988 views

I'm fairly new to programming and I'm having trouble with my program continuously looping when I try to handle a InputMisMatch exception. I have a menu which takes in user input and then uses a switch ...
U Kushi's user avatar
  • 17
0 votes
2 answers
53 views

import java.util.Scanner; public class Messdaten { public static double temperaturInDurchschnitt(Scanner sc){ int year= 0, month= 0 , day= 0; String discription = ""; ...
Saad Belkhou's user avatar
-1 votes
1 answer
64 views

This is the code I am using for my program import java.util.*; import java.io.*; import java.util.ArrayList; /** * This program will read the information from the * txt file and will organize ...
Bashar Shabani's user avatar
0 votes
1 answer
47 views

After the name, Charlie is printed out it throws the input mismatch exception and says I'm entering a string into the int scanner but it really is a number so why is it telling me it's a string? This ...
reyna's user avatar
  • 21
0 votes
1 answer
30 views

Good evening. I am trying to read doubles from a file and put them into a double array. The way I have approached this is to use a Scanner. This is my code public static void decryption(int n, int d) ...
Jesse Schultz's user avatar

1
2 3 4 5 6