Practice creating objects
Comments (74)
- Popular
- New
- Old
You must be signed in to leave a comment
Anonymous #11100313
24 February 2023, 05:34
The (Cat anotherCat) was new for me.
+2
Michael Amann Full Stack Developer
13 April 2022, 19:09
Where did Integer.compare come from? 🤯
0
Anonymous #10948087
8 March 2022, 18:44
No la entiendes porque no se ha explicado.
En Java (y en otros lenguajes como C, C++ y C#) hay un operador que se llama ternario:
(condicion) ? valor_si_verdadero : valor_si_falso;
Es una especie de if/else comprimido.
Si se cumple la condición, se ejecuta valor_si_verdadero; en caso contrario, se ejecuta valor_si_falso.
Espero que te ayude.
0
Mindre Mercedes Bautista
8 March 2022, 20:13
gracias.
ahora lo entiendo.
0
schipplock Backend Developer at n/a
9 July 2021, 11:35
I don't like that you don't have to create classes here. I know the title of the page says "Practice creating objects" but in the individual tasks it says "Create the Person class." but the class is already written. In the previous lessons one had to re-type a whole program just for practice. I think it's easy enough as of now to write the class as well. The average number of attempts for this task is 1.18 and it reflects that it's too easy :).
0
Jonaskinny Java Developer at Sandmedia
10 February 2022, 19:29
Unsolicited advice --> I created a class demonstrating all the == between various string constructs, decimal/octal/binary/unicode ... why not give yourself simple tasks like creating the class in another editor for each assignment? Also, I'm not a fan of IDE reliance, so maybe couple that practice with using commandline, jdk and a text editor only. Write sh or bat(if on windows) to set CLASSPATH and JAVA_HOME and execute your programs using ant etc. There is a ton you can do along the way if you think it's too easy. You'll also get better at tailing logs etc so when you get a position you will not be reliant on an IDE or a web-based compiler ;)
+1
Oleg
24 March 2021, 13:23
what is line "return score>2" does mean?
+1
Angelo Tratsis
15 April 2021, 12:17
great question. You don't have to write if statement. Automatically if its true will return true otherwise false
+1
Mrrobot993 Full Stack Developer
15 October 2021, 09:53
Means that (score>2) == true? return true
0
gabe
3 November 2020, 17:04
why does sally have so many cats?
+3
freewilly
2 November 2020, 01:01
char datatypes expect a single quotation 2-bit value, e.g. 'm'
String datatypes expect a double quotation, e.g. "m"
+1
Libby
4 January 2021, 06:43
Thanks for this information
0
Chung Kang
27 August 2020, 21:52
I got confused with Character vs char
+1
Angel Li
16 October 2020, 22:14
Character is the "wrapper" class of char. You use wrapper classes to make objects and when declaring the generics of stuff like Maps, Arrays, etc.
+2
Agent Smith
10 August 2020, 18:56
If you have trouble with Implement the fight method, check how your code handles these additional cases:
1) If both cats have exactly same values.
2) If cat1 has 2 better values and 1 worse than cat2.
3) If cat1 has 1 better value and 2 worse than cat2.
+5
Rose
22 June 2020, 14:24
Hint: put all variables double and you will get a double result.
+2
Nathan Guidry
15 May 2021, 15:37
just one variable a double, actually
0