Closed. This question needs to be more focused. It is not currently accepting answers. Want to improve this question? Update the question so it focuses on one problem only by editing this post. Closed 5 months ago. Improve this question I’m a Java beginner. I want to call a Method in a running Java Thread Object. It always throws this
Tag: methods
How to use generics for type safety while using `removeRange` method of ArrayList
Since the method – removeRange(int startIndex, int ) is protected, we need to use it in a class extending ArrayList. Below is my code – Output – Now to use type safety I need to write – MyClass<String> extends ArrayList<String> but doing so gives error in main method of String[] – MyClass.This cannot be referenced from a static context So
How to Convert DurationFormatUtils back to Milliseconds
Currently I have been using DurationFormatUtils to convert the Millis in a track into HH:mm:ss, but I want to allow the user to seek the track using this format, for example they would type: ‘-seek HH:mm:ss or mm:ss’ and I want to convert that time back into milliseconds… Are there any built in Java methods to do this? Or would
I have a question about one of the method java tic tac toe
This is the code about Tic Tac Toe based on what my professor said. He said I can put both step 2 and step 3 in else statement, but I don’t know how to do it. I gave it a try, but IntelliJ(the program I’m using) said it doesn’t have a return statement. I don’t why it has errors. Please
Returning a value from one method to another to be used in the output
I can’t figure out how to return the value of finalCost to the main method and have it printed. Specifically, I can’t find how to use the returned value in the “println” line. Answer You call calcMonthlyCharge(downloadLimit),but don’t store the returnvalue. When you call System.out.println(“Plan monthly cost: ” + calcMonthlyCharge(finalCost) ); It is unknown what finalcost is, this is a
What exactly happens in the JVM when invoking an object’s instance method?
I think I have finally found out how to word, what is giving me so much trouble in understanding: how the virtual machine can access a classes methods and use it only on a given instance (object) with the catch that the virtual machine is only being given the reference/pointer variable. This was compounded by the fact that most visualizations
How to call ActionPerformed method from different class
I’m trying to call an actionperformed method from a file under the same package as the one I wish to call it from. I have two classes, EditSeriesPaint and MyDataVisualization. I want to call EditSeriesPaint from MyDataVisualization. This is what I’ve tried: EditSeriesPaint Class: MyDataVisualization Class: However, when I add the method to esp and go to use the color
Having two for loop in a single Java Method
I have a method shown in the code below, I have a hashmap buffer and queue with several list in both. I want to search a particular message to set it true when it is stable; the message could be in either the buffer or queue. is it alright to lump the two for loop within a single method? or
Is this correct way to use “switch()” method in selenium?
Aim: To count links in footer section of a webpage. Instead of this: I want to write like this: Is this correct way to use “switch()” method in selenium ? Answer Unless I am mistaken, switch() is not a method belonging to the Selenium Webdriver. The method switchTo() is used to change your focus to a different window, tab or
method to find the the distance of two characters of a string apart and entering them into an array
trying to solve this question for school “Given a string s and a character c, return a new list of integers of the same length as s where for each index i its value is set the closest distance of s[i] to c. You can assume c exists in s.” for example Input s = “aabaab” c = “b” Output