Skip to content
Sign upLog in
Profile icon

Pau Lluch

@paulluch
Repls
Community
paulluch
paulluch
shared a Post
2 years ago
1
M1_UD-04 EJ-1 SumIt
I'm using this program, but it doesn't work, if I use static method (i say the lines in the program) it works. I have two doubts: How can my program w
M1_UD-04 EJ-1 SumIt
java
EpicGamer007
EpicGamer007
Ok, I noticed a few errors in your code, first of all, your class has to be called Main because it is in a file called Main.java. Second of all, for the public static void main method, i suggest making the parameters String[] args and not String args[]. Then for the method sumar, i think you should make the parameters `int[] n and not int ... n`. I feel like this would make the code more readable. Ok, onto your problem. A non-static method or variable cannot be called in a static context. That 2 years ago
Coder100
Coder100
Hi, you can't use sumar because static methods are not the same as public methods. public methods require an instance.2 years ago
paulluch
paulluch
shared a Post
2 years ago
1
it gives me the error: exit status 1 UnitTests.java:11: error: incompatible types: int cannot be converted to int[] int[] solution = Main.candyCalcula
M1_UD-03 EJ-7 Candy Calculator
java
Coder100
Coder100
Hi! The problem is int[] is an array and your function only returns an int. So have your code like this: int solution = candyCalculator(108); `2 years ago
PattanAhmed
PattanAhmed
@paulluch Hi Pau, I think changing this line of code may work, int solution=candyCalculator(108); Just change/keep this line of code. *Hope this helps Please mark my answer if this helps.*2 years ago
DynamicSquid
DynamicSquid
it seems to be working fine...2 years ago
paulluch
paulluch
shared a Post
2 years ago
1
I don't know why when I systme.out.print("Escribir caracter")it multiplies and it apears a lot of times, this program count spaces, and you have to in
M1_UD-03 EJ-1 Contar espacios
java
PattanAhmed
PattanAhmed
@paulluch Hi, Your program just works perfectly! Is there any issue to solve. If any, then most welcome here in the Ask Section Hope this helps Please mark my answer if this helps.2 years ago
DynamicSquid
DynamicSquid
it works fine for me2 years ago