Questions tagged as 'constructor'

1
answer

Does Java have a default constructor?

In a book called "Java in depth" it was specified that when creating a class in Java it was a default constructor. But, in a question from the Android App SoloLearn it appeared that the default constructors in Java do not exist. Which of the 2 i...
asked by 16.04.2018 / 16:03
2
answers

Doubt with constructor when creating a JFrame. Java

I have a question at the time of being able to use the methods from a class that inherits from JFrame, like this: class MarcoLibre extends JFrame{ } In the constructor, I can access the methods that inherit from JFrame (and their correspon...
asked by 13.07.2018 / 17:38
2
answers

Owned by a builder

The prototype of a constructor is a function. So, why in this case do you throw false ? function A() { this.n = 15; } A.prototype = {b: 2, c: 3}; Function.prototype.nn = 15; console.log(Object.getPrototypeOf(A)); co...
asked by 04.07.2017 / 15:37
3
answers

Constructor using String

I have to make a constructor in the class CancionImpl that receives a string with the values of the properties separated by semicolons (;), in the following order: type id String , artist type Artist, duration in seconds, type name...
asked by 29.05.2018 / 15:37
1
answer

Difference between creating object stability through constructor function VS class and constructor

I do not understand the difference between these two examples, one with class and another with a constructor function function personOne(name, age) { this._name = name; this._age = age; } var p = new personOne("David", 21);...
asked by 12.01.2018 / 15:52
1
answer

How to call from a constructor to another Java Constructor

I have these 3 constructors in a java class, as it would be the correct way to make one call the other, that is, call the default, that it calls the next one with fewer parameters and the latter to which it has all the parameters example:...
asked by 24.11.2017 / 01:26
4
answers

Overload constructor in inherited class

I have a Person class that has the following constructor Person(String firstName, String lastName, int identification){ And a student class that extends from Person and whose constructor I want to add one more parameter, which are the notes...
asked by 25.11.2016 / 08:47
2
answers

Overload of constructors in TypeScript

I am trying to make a class in TypeScript, in the following way: You can receive a Array<Array<string>> only or you can receive several parameters ( ancho : number , blanco : string , trozo : string ) T...
asked by 31.08.2016 / 17:35
1
answer

How to declare a constructor without arguments?

I'm trying to get all the documents from firebase and convert them directly into an object but I jump with the following error:    java.lang.RuntimeException: Could not deserialize object. Class com.chdzma.changeproject.objects.Food does not...
asked by 20.05.2018 / 20:27
1
answer

Change row color in TableView JavaFX according to its value

Good morning! To the point I have an interface where I show a table with two columns, the first one is Placa and the other is Mileage. What I want to do is to get that according to the value that the Mileage column has in its cell its Backgro...
asked by 06.10.2017 / 16:25