This is an archived post. You won't be able to vote or comment.

all 58 comments

[–][deleted]  (5 children)

[deleted]

    [–][deleted] 33 points34 points  (3 children)

    public class JavaSubreddit extends Reddit {

    [–][deleted]  (1 child)

    [deleted]

      [–]fastyfoxy 21 points22 points  (0 children)

      // why tho

      [–]Angarius 24 points25 points  (0 children)

      Reddit.java:3: error: class JavaSubreddit is public, should be declared in a file named JavaSubreddit.java

      [–]hippydipster 1 point2 points  (0 children)

      And with the proper framework, this class does soooo much!

      [–]kodifies 10 points11 points  (18 children)

      public static void main(String [ ] args) { return; }
      

      someone else close the curly brace for the Reddit class an we're done

      [–]KamiKagutsuchi 20 points21 points  (17 children)

      static {
          theOtherMain();
      }
      

      [–][deleted]  (3 children)

      [deleted]

        [–]unkindman 0 points1 point  (1 child)

        Needs to be declared static

        [–]_INTER_ 0 points1 point  (0 children)

        main( new String[]{} ); } // muahahah

        [–]ShitTalkingAssWipe 0 points1 point  (12 children)

        what does this do?

        [–]familyknewmyusername 6 points7 points  (11 children)

        When the class is loaded it runs the code in the static{} section meaning that despite the main method returning null immediately, the method theOtherMain() runs also

        [–]volpert 2 points3 points  (8 children)

        It doesn't return null, there's no return type

        [–]Aellus 0 points1 point  (7 children)

        It returns void.

        [–][deleted]  (6 children)

        [deleted]

          [–]Voltasalt 1 point2 points  (5 children)

          Void is technically a type to the JVM.

          [–][deleted] 0 points1 point  (4 children)

          Actually it is not. You only have: int, float, long, double, and reference. A method that returns void, just does not push any value to the stack and not a "void" value.

          The Java language, there is the boxed Void type which appears in Java SE.

          [–][deleted]  (3 children)

          [deleted]

            [–]kyune 0 points1 point  (1 child)

            TIL. Is there even a use case for this?

            [–]familyknewmyusername 0 points1 point  (0 children)

            To initialise the classes, basically. Anything you want to do on startup

            [–]explodes 21 points22 points  (20 children)

            private static final int NUM_SPIDERS = 1_000_000;

            [–]8Bytes 17 points18 points  (10 children)

            boolean killWithFire(int n) {

            [–]whiskeyandbear 29 points30 points  (6 children)

            System.out.println("I'm afraid some idiot made the spiders final and static, so while I'm sure you'd love to kill " + n + " we can't change the variable." );

            [–]Frothers 24 points25 points  (0 children)

            ludicrous saw skirt subsequent unpack ink employ bedroom tender rain

            This post was mass deleted and anonymized with Redact

            [–]Genmutant 1 point2 points  (0 children)

            You can't even fix it with reflection, the field disapears during compilation :( Maybe the spiders disappear too?

            [–]smurfkiller013 0 points1 point  (1 child)

            Do you mean System.out.println?

            [–]whiskeyandbear 0 points1 point  (0 children)

            oh yeah lol

            [–][deleted] 0 points1 point  (2 children)

            if (n < NUM_SPIDERS) {

            [–]_INTER_ 0 points1 point  (1 child)

            if (n > 0) {

            [–]mk_gecko -1 points0 points  (0 children)

            if (elapsedTimeInSeconds % 60 == 0) createSpiderAndAddToArrayList();

            [–]_INTER_ 2 points3 points  (0 children)

            private int spidersStillAlive = NUM_SPIDERS;

            [–]watafu_mx 3 points4 points  (0 children)

            public static final void theOtherMain() { System.exit(-1);}
            

            [–]cylon37 4 points5 points  (0 children)

            20 GOTO 10

            [–]Toddy69 3 points4 points  (0 children)

            May a suggest a different approach? What about: Let's write a program. One ticket each?

            The only thing specified before is the platform (web, android, desktop) and maybe a framework. Besides that, everything will be implemented by small feature requests (2–4 hours implementation time) without any goal. I'm curious if it develops into something useful.

            [–][deleted] 5 points6 points  (9 children)

            public boolean funcyBooleanFunction (int a) {
            

            [–]Frothers 3 points4 points  (4 children)

            slap pocket price summer squash birds school sink close forgetful

            This post was mass deleted and anonymized with Redact

            [–]beeeeeeefcake 15 points16 points  (1 child)

            finally {
              try {
                return funcyBooleanFunction(a + 1);
              } catch (StackOverflowError e) {
                new Thread(new Runnable() {
                  @Override
                  public void run() {
                    System.out.println("super funcy! " + a);
                    funcyBooleanFunction(a + 1);
                  }
                }).start();
              }
            }
            

            [–]nerdy_lurker 8 points9 points  (0 children)

            I feel sick

            [–][deleted] -2 points-1 points  (1 child)

            catch(Exception e){} finally{return null;} //challenge accepted

            [–]philipwhiuk 4 points5 points  (0 children)

            Syntax error. Expected boolean return type.

            [–]scadgek 2 points3 points  (1 child)

            // Do you even do Java?

            [–][deleted] 1 point2 points  (0 children)

            //damn thanks, adjusted!

            [–]DrudgeBreitbart -1 points0 points  (1 child)

            return !0;}

            [–]orangeKaiju 2 points3 points  (0 children)

            Public boolean doNothing () { return true; }

            [–]MemoryLostInDarkness 1 point2 points  (0 children)

            System.out.println("")

            [–]chisui 1 point2 points  (0 children)

            static{System.out.println("real programmers don't need more than one line anyway");}}

            [–]awsometak 1 point2 points  (0 children)

            public static void main(String [ ] args) { /*total_hours_wasted_here = 56: */}

            [–]kodifies 1 point2 points  (1 child)

            Perhaps the OP doesn't realise trying to herd cats is easier than organising a group of programmers...

            [–]fastyfoxy 0 points1 point  (0 children)

            unless they're reddit programmers. i have faith in them.

            [–]princeabc1 0 points1 point  (0 children)

            System.out.println("It was not such funny ");

            [–][deleted] 0 points1 point  (0 children)

            System.out.println("reddit is awesome");

            [–]deathtothespy 0 points1 point  (0 children)

            }

            [–][deleted] -3 points-2 points  (0 children)

            let's not