#Classes and List issues
1 messages · Page 1 of 1 (latest)
<@&987246399047479336> please have a look, thanks.
ask a question ig
Could you share more about what you are having issues with?
OH MY GOD
@wide bridge@torn raven@limpid sage
I AM SO SORRY
MY BROTHER CAME IN AND POOED HIS PANTS
SO I COULDNT DO POST
I HAD TO RUSH HIM TO TOILET
bruh can you stop trolling?
this channel is for serious questions
you are
when i try to enter data in my list
at least writing in full caps is trolling
from one class
dint know
anyways
I have a method
for entering data
from one class, to another class's list
when i enter the data and print it, the data i entered appears
but
when I re call that method
and enter another data
the data that i entered previously
does not print
but only the new data that i entered
It's hard for people to remark upon without any code, and please be aware that random remarks/poor post quality isn't the best way to get help.
❔
import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;
public class Users {
public static void main(String[] args) {
Users users = new Users();
users.Registration();
}
List<String> Username = new ArrayList<>();
public void Registration(){
Withdrawal_System Reg = new Withdrawal_System();
Users user = new Users();
System.out.println("To register your self, please enter your name");
Scanner scanner = new Scanner(System.in);
System.out.println(" ");
user.Username.add(scanner.nextLine());
System.out.println("your name has been registered");
System.out.println(user.Username);
System.out.println("What would like to do next");
Reg.NewAction();
}
}
Please use this format for posting code:
```java
// Example java program
int value = 5;
System.out.println(value);
```
Which results in:
// Example java program
int value = 5;
System.out.println(value);
For syntax highlighting, you have to add the name of the language after the three backticks, like ```java. Please make sure to use exactly this format, so no space between the backticks and the language name, and a newline before the code starts. If done right, the syntax highlighting will even be applied to your text as you type, before sending.
drag drop the file
what file
ok here is a piece
System.out.println(" ");
System.out.println("1 | Book Options");
System.out.println("2 | WithDrawal");
System.out.println("3 | Return");
System.out.println("4 | Register");
System.out.println(" ");
Scanner scanner = new Scanner(System.in);
String answer = scanner.nextLine();
if(answer.equals("1")){
Option1();```
Detected code, here are some useful tools:
public void NewAction() {
System.out.println(" ");
System.out.println("1 | Book Options");
System.out.println("2 | WithDrawal");
System.out.println("3 | Return");
System.out.println("4 | Register");
System.out.println(" ");
Scanner scanner = new Scanner(System.in);
String answer = scanner.nextLine();
if (answer.equals("1")) {
Option1();
method names do not start with uppercase
dk how i promise
DOne
You don't do anything with your user, so it makes sense it does nothing. This was also code that could have been shared using the tag/dragged as a file. As others have remarked, kindly take others time and efforts into account.
troll 101
