[Solved] I can’t access a method in a class [closed]

Most of your errors are in JavaApplication62 class. Ive corrected them to get the desired output you want. There are still many problems with all your classes. I’ll Leave that up to you to rectify. Look to the comments for the corrections. /** * Created by Ninan John J P on 6/30/2016. */ import java.util.Scanner; … Read more

[Solved] Extracting a char from a string

You can’t parse a String which represents a Double with Integer.parseInt(). This will not work: Integer.parseInt(“3.0”); This will work: Integer.parseInt(“3”); Use this instead: new Double(“3.0”).intValue() But consider following behavior: new Double(“2.5”).intValue() will return 2. 2 solved Extracting a char from a string

[Solved] Java 8 comparator not working

The comparator seems correct. The problem seems to be in your filter clause, where you compare the event id to the device id lastDeviceEvent = deviceEvents .stream() .filter (o -> o.getDeviceId().equals(deviceId)) // Original code used getId() .sorted(comparing((DeviceEvent de) -> de.getId()).reversed()) .findFirst() .get(); solved Java 8 comparator not working

[Solved] Big O Notation/Time Complexity issue

It would be O(N). The general approach to doing complexity analysis is to look for all significant constant-time executable statements or expressions (like comparisons, arithmetic operations, method calls, assignments) and work out an algebraic formula giving the number of times that they occur. Then reduce that formula to the equivalent big O complexity class. In … Read more

[Solved] Java: Combining the inputs of a while loop

Here is the code together with some comments. import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.ArrayList; import java.util.List; //import java.util.Scanner; public class Ingredients { public static void main(String [] args)throws IOException{ BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); //or Scanner scan = new Scanner(System.in); int ingredientID=0; int sumOfIngredients=0; System.out.println(“Keep selecting the ingrients that you want until … Read more

[Solved] Click and drag option (JAVA)

To automate mouse clicks, holds and moves you can look into the Robot Class This is the basics of a mouse click: where x and y is the coordinate of the point on the screen in pixels where you want to click. public static void click(int x, int y) throws AWTException{ Robot bot = new … Read more

[Solved] Java equals function not working correctly [closed]

may be case is not matchingyou can try 1) if (newString.matches(aVar)){ } or 2) if (newString.equalsIgnoreCase(aVar)){ } or try with newString.trim() then compare trim() method removes spaces after and before the variable like if String s=”abc “; //space at last s.trim() will remove last space and return “abc” 3 solved Java equals function not working … Read more

[Solved] How to call an Object Method in Java

public class newCharacters { Character person1 = new Character(2, 4, 3); person1.getStat(“atk”); } This should not be in a class. This does not mean anything. A class can have bunch of instance variables and methods. Please study the basics well 😉 Put it in a main method inside the Character class public static void main(String … Read more