Skip to content
Advertisement

Tag: class

How to call a method twice in a row?

I have a code where in my class I would like to be able to call the method answer twice like qns.answer(5).answer(7). But right now when I call the method answer as below, I get the error cannot find symbol. For example: Would appreciate if you could kindly give some pointers on how to get around this. Answer Question can

data type and calculate average in java

I am working on a java code that calculates the average of grades in an array for N of students and it is working fine when I enter grades like {3,4,3} but when I use numbers with decimals like {3.7,2.5,3.2} it starts giving me errors and I want to make a class of data type Students for example. Any help

How to implement a generic interface that extends another generic interface in Java?

I am new to Java and working on implementing generic interfaces and that’s where I’d love some help. I want to implement a generic interface in Java that extends another interface. This is how the current interface structure looks like – I want to implement the ItemsProviderInterface interface and provide a definition for convertInput(), convertResponse(), request() methods. Maybe something like

Converting Class of an Object into a Child Class

Say I have the following classes Then I get an object from an array of Parents If this object is of the child class, I want to cast the tempParent into the child class in order to use “doSomething” without having to create a new object This, however, does not work. I still get an error telling me that doSomething

ClassNotFoundException thrown

I have an issue with my program for a project assignment throwing multiple ClassNotFoundException. I think the problem stems from the BaseGear class, which is the abstract super class for all items in the game. Each item must be restricted by class so in the constructor the string restrict is provided as an argument which I then try and convert

Advertisement