My coworker wrote this on a sticky note and told me to type it exactly into a java thingy online and hit “run.” Should I do this?

Update:

void never

end(){

  If  (334 ➗ 1 ==o)    neverend();

  Else

     Return;

}

5 Answers

Relevance
  • Chris
    Lv 7
    2 weeks ago

    If I turn this into valid Java and run it I get a stack overflow error as expected: https://ideone.com/TOdd6b (that link shows the result, it won't run the program)

    • Chris
      Lv 7
      2 weeks agoReport

      "Robert" is a troll anyway, there's no coworker and no sticky note, much less a weird percent-like symbol on paper that was badly transcribed into an old school "divided by" symbol.

  • ?
    Lv 5
    2 weeks ago

    Looks like it is supposed to be a recursive function that will overflow the stack, and cause the system to crash.

    I knew some guys who managed to to this on a Xerox BTM (Batch Timesharing Monitor) system in the 70s.

    But modern commercial Operating Systems will just kill the user process when the stack overflows.

    50 years ago this was sort of cool and hackerish. But now it is just lame.

    • Richard
      Lv 7
      2 weeks agoReport

      A decent modern operating system should limit the amount of memory the process can use. In this case, it should run until a stack overflow causes the OS to stop the program.

      The system should not crash.

  • 2 weeks ago

    I don't see this doing anything, don't think the syntax is right for Java either.

  • 3 weeks ago

    It won't do anything.  It's not valid Java, or anything else as far as I can tell. 

    1. You can't have a newline in the middle of a function name.

    2. Keywords "if", "else" and "return" are not capitalized.

    3. The division operator is /, not ÷.

    4. The name "o" is undefined.  Maybe he meant "0" (zero) instead?

    Even if you fixed those, that's a method definition--code that say what to do when the method is called.  It won't run unless it's called; and that needs a line added to some method that does run to perform that call.

    And, finally, depending on where that neverend() method is compared to where it's called from, you might need to and keywords "public" and/or "static" in front of void.

  • What do you think of the answers? You can sign in to give your opinion on the answer.
  • 3 weeks ago

    It's recursive function that calls itself all the time, it will probably just timeout or crash your web instance. If you're using your own IDE, then it may freeze  your pc for a while.

    Run it, nothing wrong with doing it

    • husoski
      Lv 7
      3 weeks agoReport

      Since 334 / 1 is never zero, that's going to end right away, despite what the function name says.

Still have questions? Get answers by asking now.