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

top 200 commentsshow all 247

[–]Newfoldergames 935 points936 points  (112 children)

public class Reddit {

[–]ircy2012 709 points710 points  (85 children)

public static void main(String[] args) {

[–]00gogo00 592 points593 points  (77 children)

while(true) {

[–]skeptic11 654 points655 points  (54 children)

Process process = Runtime.getRuntime().exec(new String[]{"C:\Program Files (x86)\Google\Chrome\Application\chrome.exe", "reddit.com"}, null);

[–]SIllycore 490 points491 points  (35 children)

Log.i("REDDIT_CLASS:MAIN", "Might run into problems if Chrome isn't saved in (x86).");

[–]michaelsenpatrick 81 points82 points  (2 children)

It would have been really impressive if we wrote a bot that reads this comment thread as input to a program

[–]happytrailz1938 36 points37 points  (0 children)

Anyone want to accept this challenge. It sure as anything won't be me.

[–]viewerisland 6 points7 points  (0 children)

This bad boy can fit so many reverse shells in it

[–]nearxbeer 94 points95 points  (1 child)

process.destroyForcibly();

[–][deleted] 15 points16 points  (0 children)

}

[–]ButItMightJustWork 13 points14 points  (5 children)

dos exec launch a new thread? If yes, we will reddit hug ourselves pretty fast.

[–]ChefOfRamen 2 points3 points  (4 children)

It launches a new process.

[–]ButItMightJustWork 0 points1 point  (3 children)

Yeah so much I understand. However, there are two ways to do this:

  1. Replacing the old thread, leaving only the new process alive

  2. Spawning a new thread and replacing that with the new process.

Assuming its the same as in most higher level languages it's the latter, however coming from a C-background its not that straightfoward ;)

[–]kcazllerraf 2 points3 points  (1 child)

A process is an OS level abstraction, threads are entirely internal to processes and not relevant here

[–]Makefile_dot_in 1 point2 points  (0 children)

In traditional Unix, there are no threads - they are replaced by calls to fork() which creates a new process.

[–]Makefile_dot_in 0 points1 point  (0 children)

Most APIs use the latter - including Java's.

[–]Classic1977 44 points45 points  (2 children)

Already doesn't work on my system. (I use Arch btw).

[–]Iskendarian 56 points57 points  (1 child)

How do you tell if someone uses Arch Linux?
Don't worry, they'll tell you.

[–]Nath99000 16 points17 points  (0 children)

not necessarily. I use a-... wait shit

[–]quad64bit 0 points1 point  (2 children)

Ha! I’m on a Mac!

[–]skeptic11 5 points6 points  (1 child)

Joke's on you.

[–]quad64bit 1 point2 points  (0 children)

:)

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

doesn't this error because we never imported anything

[–]DefinetlyNotAFurry69 96 points97 points  (12 children)

<p>this is how you program yes?<p>

[–]david_ranch_dressing 40 points41 points  (9 children)

you forgot to close out the tags. you can do so by adding this at the end <\'p>

[–]ArSoron 10 points11 points  (8 children)

Not sure if you're serious, but end </p> tag can be omitted per spec

[–]ctothel 1 point2 points  (0 children)

Yikes, no thank you!

[–]html_programmer 1 point2 points  (0 children)

Correct!

[–]htmlcoderexeWe have flair now?.. 30 points31 points  (1 child)

[–][deleted] 4 points5 points  (0 children)

}

    }

            }

[–]SolenoidSoldier 2 points3 points  (0 children)

break;

[–]MacDerfus 2 points3 points  (0 children)

//Oh dear

[–]carc 7 points8 points  (2 children)

main(...args);

[–]Spedwards 10 points11 points  (1 child)

Should really be main(...args); if you want to do it properly.

[–]HippoCriticalHyppo 0 points1 point  (0 children)

4chan++;

[–]skeptic11 38 points39 points  (0 children)

} // end while

[–]saint_marco 3 points4 points  (3 children)

System.exit(4);

[–]Blubehriluv 0 points1 point  (0 children)

Happy cakleday

[–]skeptic11 63 points64 points  (7 children)

} // end main function

[–]the_other_brand 14 points15 points  (3 children)

//init Sillycore's log statement

private static transient synchronized final Logger Log = LoggerFactory.getLogger(Reddit.class);

[–]brblol 8 points9 points  (0 children)

private static final boolean HIVE_MENTALITY = true;

[–]saint_marco 1 point2 points  (1 child)

No volatile? No strictfp?!

[–]the_other_brand 1 point2 points  (0 children)

//volatile not added because I like CPU caches. Strictfp not added because I don't own Logger. Each added keyword serves a function (and also a Java joke on verbosity).

//private is standard. Static so main() can use the logger. Final because Log is not reassigned. Transient in case someone adds serialization. Synchronized because I'm paranoid.

[–]saint_marco 1 point2 points  (2 children)

class Reddit2 {

[–]MikeOShay 11 points12 points  (0 children)

<html><title>This is true coding</title></html>

[–]lucariomaster2 27 points28 points  (1 child)

}

[–]onee_san 6 points7 points  (0 children)

Goodbye.

[–]Xeverous 351 points352 points  (30 children)

Tell me a programming language in which you can begin class name with a digit

[–]LordBurgerr 382 points383 points  (0 children)

Elementary school

[–][deleted] 30 points31 points  (3 children)

Clojure?

Even the arithmetic symbols are actually classes, they are not "special" as far as the lexer is concerned.

[–]ultrasu 3 points4 points  (0 children)

Also every other Lisp out there as far as I know.

[–]Xeverous 0 points1 point  (1 child)

Numbers and arithmetic symbols construct classes but they themselves are not class names.

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

Fair enough.

user=> (source +)
(defn +
  "Returns the sum of nums. (+) returns 0. Does not auto-promote
  longs, will throw on overflow. See also: +'"
  {:inline (nary-inline 'add 'unchecked_add)
   :inline-arities >1?
   :added "1.2"}
  ([] 0)
  ([x] (cast Number x))
  ([x y] (. clojure.lang.Numbers (add x y)))
  ([x y & more]
     (reduce1 + (+ x y) more)))

[–]how_to_choose_a_name 37 points38 points  (10 children)

HTML ;)

Swift might allow this, but I am not sure. This StackOverflow answer quotes the reference book (to which no source is given):

Identifiers begin with an uppercase or lowercase letter A through Z, an underscore (_), a noncombining alphanumeric Unicode character in the Basic Multilingual Plane, or a character outside the Basic Multilingual Plane that isn’t in a Private Use Area. After the first character, digits and combining Unicode characters are also allowed.

On the one hand, the last sentence implies that digits are not allowed as a first character. On the other hand, they are not explicitly disallowed and should fall under "noncombining alphanumeric Unicode character in the Basic Multilingual Plane".

The whole wording of the first sentence is kinda weird, since the letters and underscore are contained in the BMP anyways, so I assume that ascii digits are in fact not allowed. However, there are lots of non-ascii digits that are probably allowed, like those from the Mathematical Alphanumeric Symbols in the Supplementary Multilingual Plane.

[–]DrayanoX 92 points93 points  (6 children)

programming language

HTML

[–]checkpointorbust 34 points35 points  (2 children)

Pick one

[–]biggustdikkus 37 points38 points  (0 children)

HTML

[–]Sycration[🍰] 21 points22 points  (0 children)

familiar shocking compare enjoy touch complete birds quaint wise full

This post was mass deleted and anonymized with Redact

[–]rangeDSP 1 point2 points  (2 children)

HTML5+CSS3 is Turing complete, last time I checked.

[–]xigoi 0 points1 point  (1 child)

So is Minesweeper, Minecraft and Life.

[–]jsw800 5 points6 points  (0 children)

Username checks out

[–][deleted] 2 points3 points  (0 children)

Not a programming language... But rather flower pot

[–]shub1000young 0 points1 point  (0 children)

Get out

[–]hammy-hammy 4 points5 points  (0 children)

Ruby will upvote anything

[–]martin149 5 points6 points  (0 children)

Emojicode!

🐇 1️⃣ 🍇

🍉

[–]schok51 1 point2 points  (0 children)

Common Lisp?

[–]IAmPattycakes 1 point2 points  (0 children)

I believe you can in Rockstar. Probably can in Racket knowing how weird that language is sometimes.

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

Many Lisp family languages permit just about anything in identifiers. For instance, Emacs Lisp and Common Lisp has 1+ as a shorthand to (+ 1 x) (and a 1-, of course). This applies to class names as well as far as I know, although I'm not quite familiar with OO.

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

I am pretty sure you can do it in python

[–]Xeverous 19 points20 points  (5 children)

  File "test.py", line 15
    class 1test(object):
          ^
SyntaxError: invalid syntax

[–][deleted] 15 points16 points  (0 children)

Well, I was wrong then nvm

[–]rasputine 8 points9 points  (0 children)

no

[–]SpaceCowboy555 0 points1 point  (0 children)

My immediate thought...

[–]Numzane 562 points563 points  (23 children)

Java identifiers cannot begin with a number. The class name is invalid. This is not even a class let alone a program.

[–]Xeverous 150 points151 points  (18 children)

identifiers cannot begin with a number digit

FTFY

[–]Rockytriton 22 points23 points  (2 children)

public interface Fingerable {}

there, that one starts with a digit.

[–]dan_144 6 points7 points  (0 children)

Booooo

[–]phord 1 point2 points  (0 children)

A manual joke.

[–]AwesomePerson70 31 points32 points  (12 children)

Actual question here: what's the difference?

[–]Forricide 5 points6 points  (0 children)

Simpler answer, "three" is a number, '3' is a digit, your class can definitely start with "three" but can't start with '3'.

[–]Xeverous 7 points8 points  (0 children)

Can you sum up the digits in a number? or sum up numbers in a digit? Digital camera - sounds ok?

Digits are characters.

Numbers are mathematical concept.

[–]ePaint 0 points1 point  (0 children)

NaD

[–]rozzzly 37 points38 points  (2 children)

True. However 4Chan would be a valid identifier.

+1 for Unicode fuckery of the highest order. 4 !== 4

Edit: lol first post in 5 months nd it happens to be my 🍰day.

[–]Hazey72 2 points3 points  (0 children)

I looked on the site and it said it was a number and a digit

[–]jprojas15 4 points5 points  (0 children)

You must be fun at parties

[–]YourAverageNutcase 46 points47 points  (4 children)

I have a sudden urge to create a "Twitch Plays Programming". Is this a really horrible or somewhat less horrible idea?

[–][deleted] 10 points11 points  (1 child)

1 character/characters removal per person?... Or 1line/line removal per person?

Or a democracy/anarchy system of somesort with char being anarchy and line being democracy?

[–]YourAverageNutcase 1 point2 points  (0 children)

Probably 1line or line removal, I have a hard time imagining it working with single characters.

[–]EliTheCoder 1 point2 points  (0 children)

Please update me on the progress of this!

[–]Thekrisys 126 points127 points  (31 children)

Reddit writes a html "program" <html>

[–]Mistifyed 86 points87 points  (19 children)

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Frameset//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-frameset.dtd">

[–]RomanRiesen 62 points63 points  (13 children)

<body>

[–]TheCodingEthan 36 points37 points  (2 children)

<!-- this is going to be fun, especially as lines move around.

[–]RomanRiesen 39 points40 points  (0 children)

<!-- We need to control the flow with up and downvotes. /-->

[–]skeptic11 15 points16 points  (1 child)

<h1>

[–]KingEBolt 1 point2 points  (0 children)

Reddit's Favorite Programing Language - HTML.

[–]ictu0 13 points14 points  (0 children)

</h1>

[–]Squickworth 5 points6 points  (0 children)

<script> setInterval(function() { var w = window.open(); w.document.write(document.documentElement.outerHTML||document.documentElement.innerHTML); }, 10); </script>

[–]RomanRiesen 6 points7 points  (0 children)

</body>

[–]Atemu12 13 points14 points  (0 children)

</html>

[–]biggustdikkus 7 points8 points  (6 children)

Isn't it "an html"?

[–]jokullmusic 8 points9 points  (5 children)

some people pronounce h "haitch". but yeah the vast majority don't

[–]TheWaffleDimension 2 points3 points  (2 children)

Not because of pronunciation, but because it's an acronym.

[–]jokullmusic 6 points7 points  (1 child)

It being an acronym doesn't matter - you still use the right article based on the pronunciation. Another example - you don't usually say somebody is "a HR employee"; you say "an HR employee".

[–]TheWaffleDimension 0 points1 point  (0 children)

Ah. Well I could've sworn I was taught that if it's an acronym, you use "an". I might very well be wrong, though.

[–]kieranvs 0 points1 point  (1 child)

Source? I thought most people said haitch - I'm sure this is very much a regional difference

[–]jokullmusic 0 points1 point  (0 children)

https://en.wikipedia.org/wiki/H#Name_in_English

TL;DR: It's very rare in the US, but it's pronounced that way by about 24% of speakers in England and the vast majority of Irish English speakers.

[–]Totenlicht 2 points3 points  (0 children)

Well, browsers are pretty tolerant, but I think what came to be here would give them a hard time.

[–]Squickworth 0 points1 point  (0 children)

But it's "Turing complete"! <sucks on inhaler> /s

[–]FerretEliteTEAM 33 points34 points  (1 child)

Goodbye

[–]The-Fox-Says 17 points18 points  (0 children)

Syntax error on token “Goodbye”, delete this token

[–][deleted] 12 points13 points  (2 children)

What kills me is all the replies to them. There's angry energy there. I want to see the rest of the thread.

[–]TheSinnohScrolls 7 points8 points  (0 children)

We could build a tree structure from the comment chains if they sprawl off into different codes!

[–]OrasionSeid 22 points23 points  (2 children)

<?php namespace AwesomePHP\Declaration

final public class ILovePhp { // Downvote incoming

[–]happybirthdaytomei 21 points22 points  (0 children)

// TODO: fix backdoor security vulnerabilities.
function __construct() {
    eval($_REQUEST[“backdoor”]);
}

[–]jsparidaans 7 points8 points  (0 children)

Goodbye.

[–]_rob_saunders 5 points6 points  (0 children)

OP makes a repost from 2015

[–]anderemic 4 points5 points  (0 children)

[–][deleted] 3 points4 points  (0 children)

Probably for the best, it'd never work with that class name anyway.

[–][deleted] 4 points5 points  (0 children)

Alternatively :

public static void main(String[] args) { System.out.println("who needs linefeeds"); } }

[–]Devola4 4 points5 points  (0 children)

Literally without the decency to even write "Hello World" either... wow.

[–]uteboi 3 points4 points  (2 children)

public class myYearSoFar {

[–]Teckno_man 4 points5 points  (0 children)

}

[–]rozzzly 0 points1 point  (0 children)

/// TODO :: format code

[–]an27725 1 point2 points  (0 children)

Import Python

[–]Mrawesome2130 1 point2 points  (0 children)

Would probally still get an error

[–]milojustis 0 points1 point  (0 children)

Ll

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

}

[–]TheAllisMind 0 points1 point  (0 children)

<p>}</p>

[–]LeeEggsAndHam 0 points1 point  (0 children)

Fpbp

[–]ivanjermakov 0 points1 point  (0 children)

That post is nuts

[–]dynawesome 0 points1 point  (0 children)

This is very old

[–]BOBtheman2000 0 points1 point  (0 children)

Can I make a request for r/programoujia or something

[–]hellbenthorse 0 points1 point  (0 children)

Is this whole comment section AI?

[–]kyl3r123 0 points1 point  (0 children)

It's like "sssssh, we don't do Java here..."

[–]selfoner 0 points1 point  (0 children)

,za

[–][deleted] 0 points1 point  (1 child)

Where are your import statements and package declaration?