Tag: GETTER-SETTER
Por ejemplo, tengo este getter: class MyClass<T>{ MyClass(this._value); T _value; T get value{ print(“Getter llamado”); return _value } } <p>MyClass myClass = MyClass([]); // ¿Cómo puedo verificar si el getter se llamó así: myclass.v; // o de esta forma (llamar al método desde él) myClass.v.add(); Espero que me entiendas (mi . . . Read more
Estoy tratando de hacer una función de obtener miembro público que devuelva la variable privada “emp”. Pero obtengo un error en mi función de obtener que dice: “El tipo de valor de retorno no coincide con el tipo de función”. Sé que en C++ el tipo de retorno no puede . . . Read more
Estoy tratando de crear una página de detalles del producto. La página de detalles se llama _id. Cuando se abre, el id se reemplaza por el id del producto. Al abrir la página, el estado se establece con los datos obtenidos de una API. Después de eso, estoy tratando de . . . Read more
public class Testing { public static void main(String[] args) { String test = “test”; Scanner type = new Scanner(System.in); String theTest = type.next(); switch(theTest) { case “test”: int input = type.nextInt(); System.out.println(“OK”); } } } public class TestingB { private int finalInput; finalInput = input; // Quiero asignarle a finalInput . . . Read more
public enum EventTypeName { MAIN_EVENT(new MainEvent()), MAIN_ADJUSTMENT_EVENT(new MainAdjustmentEvent()), CUSTOMER_EVENT(new CustomerEvent()), EventType eventType; private EventTypeName(EventType eventType) { this.eventType = eventType; } public EventType getEventType() { return eventType; } public void setEventType(EventType eventType) { this.eventType = eventType; } }