About 848,000 results
Open links in new tab
  1. wait - How do I make a delay in Java? - Stack Overflow

    613 I am trying to do something in Java and I need something to wait / delay for an amount of seconds in a while loop.

  2. How do I use optional parameters in Java? - Stack Overflow

    1 Java now supports optionals in 1.8, I'm stuck with programming on android so I'm using nulls until I can refactor the code to use optional types.

  3. How do I make the method return type generic? - Stack Overflow

    May 24, 2016 · Afaik, Java and most typed languages don't overload methods or functions based on return type. For instance public int getValue(String name){} is indistinguishable from public boolean …

  4. Function within a function in Java - Stack Overflow

    Jan 13, 2017 · 52 The reason you cannot do this is that functions must be methods attached to a class. Unlike JavaScript and similar languages, functions are not a data type. There is a movement to make …

  5. java - Make a negative number positive - Stack Overflow

    Jan 30, 2009 · Well, as for how you actually do it in Java, it's very simple, because Java already provides a function for that, in the Math class: value = Math.abs(value); Yes, doing it without …

  6. Return different type of data from a method in java?

    19 No. Java methods can only return one result (void, a primitive, or an object), and creating a struct -type class like this is exactly how you do it. As a note, it is frequently possible to make classes like …

  7. java - When to use static methods - Stack Overflow

    Mar 6, 2017 · I am wondering when to use static methods? Say if I have a class with a few getters and setters, a method or two, and I want those methods only to be invokable on an instance object of the …

  8. How to pass a function as a parameter in Java? [duplicate]

    More answers on how to use a Lambda function, or pass it as a parameter: simple example parameter as a function java.

  9. How do I return a value from a Java function? - Stack Overflow

    Dec 28, 2016 · In order to make use of a return a value from a function you must assign it to a variable or use it as a test condition, etc.

  10. How to asynchronously call a method in Java - Stack Overflow

    Dec 4, 2009 · 139 Java 8 introduced CompletableFuture, available in the package java.util.concurrent.CompletableFuture, which can be used to make an async call :