What’s wrong with this code??? I don’t know why Scanner doesn’t work | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

What’s wrong with this code??? I don’t know why Scanner doesn’t work

https://code.sololearn.com/cAbL26s5dVJA/?ref=app

27th Feb 2019, 6:19 PM
Tomás Atrat
5 Answers
+ 4
I would use the scanner inside the main class: public class Trigonometry extends Formula { public static void main(String[] args) { Scanner s = new Scanner (System.in); int hip= s.nextInt(); System.out.print(hip); } } int hip --> nextInt() String hip --> next() or nextLine() double hip --> nextDouble() and so on (nextChar is not possible) ...
27th Feb 2019, 11:17 PM
Denise Roßberg
Denise Roßberg - avatar
+ 2
Tomás Rodríguez Your welcome :)
28th Feb 2019, 12:56 AM
Denise Roßberg
Denise Roßberg - avatar
+ 1
It seems it works well
27th Feb 2019, 9:11 PM
Parsa Gholipout
Parsa Gholipout - avatar
+ 1
Why don't you call next() method inside the main()?
27th Feb 2019, 9:11 PM
Parsa Gholipout
Parsa Gholipout - avatar
+ 1
Thank you Denise, i have just debuged my code!!
28th Feb 2019, 12:53 AM
Tomás Atrat