0

Could you help me learn Java? I’m a beginner and could use some guidance. I’ll present the first code to you for feedback.

https://sololearn.com/compiler-playground/c8bHZKzY6oV7/?ref=app

2nd Sep 2024, 5:17 PM
eli
eli - avatar
9 RĂ©ponses
+ 5
eli are you looking for the user's responses ? I see your responses but nothing from the user side which input
2nd Sep 2024, 5:22 PM
BroFar
BroFar - avatar
+ 4
You are not using any input. Remove line 7, 10, and 16. Look at the differences of println and print
2nd Sep 2024, 5:30 PM
Lisa
Lisa - avatar
+ 3
eli you are missing \n on lines 11 and 17 based on your last comment System.out.print("Enter your name: Eli "); String name = input.nextLine(); System.out.println ("\nHi my name is Eli "); System.out.print("Enter your age: 1000 "); int age = input.nextInt(); System.out.println ("\nI'm 1000 years old");
2nd Sep 2024, 5:29 PM
BroFar
BroFar - avatar
0
i wanted it to look like this😭 : Enter your name: Eli Hi my name is Eli Enter your age: 1000 I'm 1000 years old
2nd Sep 2024, 5:26 PM
eli
eli - avatar
0
woah it did worked! but the I'm 1000 years old didn't. My teacher didn't teach me that-,-
2nd Sep 2024, 5:32 PM
eli
eli - avatar
0
ohhh I see. thanks maam
2nd Sep 2024, 5:36 PM
eli
eli - avatar
0
try this mate: import java.util.Scanner; public class Program { public static void main(String[] args) { Scanner input = new Scanner (System.in); System.out.print("Enter your name: "); String name = input.nextLine(); System.out.println ("\nHi my name is" + name); System.out.print("Enter your age: "); int age = input.nextInt(); System.out.println ("I'm " + age + " years old"); } }
4th Sep 2024, 2:23 PM
SIVA GURU K
SIVA GURU K - avatar
0
i can't input my name, but thanks
4th Sep 2024, 4:48 PM
eli
eli - avatar
0
i would be happy to help you learn Java, Share the first piece of code you’ve written, and I’ll give you feedback or guidance. Don’t hesitate to ask any specific questions you have along the way. If you are interested in more structured learning, Uncodemy Institute offers excellent resources and courses for beginners. Let’s get started
7th Sep 2024, 11:17 AM
Sanjeet Singh
Sanjeet Singh - avatar