Registration has been disabled and the moderation extension has been turned off.
Contact an admin on Discord or EDF if you want an account. Also fuck bots.

Java: Difference between revisions

From Encyclopedia Dramatica
Jump to navigation Jump to search
imported>Freecookies
Cleaned up the article.
Tags: Mobile edit Mobile web edit
 
(41 intermediate revisions by 25 users not shown)
Line 1: Line 1:
{{haxor}}
{{FactCat|'''[[Lie|JavaScript is not Java.]] If you were looking for [[Javascript]], you might want to look [[Javascript|here]], [[you]] ignorant fuck.'''}}
{{FactCat|'''[[Lie|JavaScript is not Java.]] If you were looking for [[Javascript]], you might want to look [[Javascript|here]], [[you]] ignorant fuck.'''}}


[[Image:Java-Plate-1.jpg|right|thumb|Well they won't get pulled over for speeding.]]
<center><youtube>Mk3qkQROb_k</youtube></center>
[[Image:JavaHelloWorldRam.jpg|thumb|There is no excuse.]]
[[Image:Sun_disappoint.jpg|right|thumb|Bloatware.]]
[[Image:Jawa.jpg|right|thumb|A Jawa.]]
 


Java is an [[Slowpoke|interpreted]] language which is [[Special|unique]] in that it includes a pretend compiler so that [[Skript kiddie|Java programmers]] can feel like they're using a [[C|grownup programming language]]. It is [[Objectivism|object oriented]] and has automatic [[garbage]] collection to make it as easy as possible to allocate memory.
Java is an [[Slowpoke|interpreted]] language which is [[Special|unique]] in that it includes a pretend compiler so that [[Skript kiddie|Java programmers]] can feel like they're using a [[C|grownup programming language]]. It is [[Objectivism|object oriented]] and has automatic [[garbage]] collection to make it as easy as possible to allocate memory.


Java is like [[Alzheimers]]; it starts slow and eventually, it takes away all of your memory. Something Java fans like to talk about is the [[Ebonics|JIT]] compiler which eventually does turn Java into [[Machine code|native code]] but only after it's been interpreted [[Over 9000|10,000]] times. By that time the program has probably already crashed with an out of memory error. Programming in Java drives most [[hacker]]s permanently [[insane]]. Evidence of this can easily be obtained by attempting to comprehend the content of [http://www.picocontainer.org/ this website].
Java is like [[Alzheimers]]: it starts slow and eventually takes away all of your memory. Something Java fans like to talk about is the [[Ebonics|JIT]] compiler which eventually does turn Java into [[Machine code|native code]] but only after it's been interpreted [[Over 9000|10,000]] times. By that time the program has probably already crashed with an out of memory error. Programming in Java drives most [[hacker]]s permanently [[insane]]. Evidence of this can easily be obtained by attempting to comprehend the content of [http://picocontainer.codehaus.org/ this website].


Java is notable (along with [[Flash]]) for being one of the few technologies that allows [[Alan Turing]] to [[pwn]] your [[browser]]. Also of note is that Java is one of the most bloated languages with a minimum of twelve lines needed to do something as complex as print "Hello" on the screen.
Java is notable (along with [[Flash]]) for being one of the few technologies that allows [[Alan Turing]] to [[pwn]] your [[browser]]. Also of note is that Java is one of the most bloated languages with a minimum of twelve lines needed to do something as complex as print "Hello" on the screen.


Java is like [[C]] for people who are too [[pussy]] to do real programming. Instead of creating actual fucking programs anyone can run on any computer, one must have a separate interpreter installed on their computer in order to run the bytecode, which is what Java calls code that's been "compiled". Unfortunately, since no one has installed this since Flash came out, no one will be able to use your user-programmable Pokedex (only 500MB!)
Java is like [[C]] for people who are too [[pussy]] to do real programming. Instead of creating actual fucking programs anyone can run on any computer, one must have a separate interpreter installed on their computer in order to run the bytecode, which is what Java calls code that's been "compiled". Unfortunately, since no one has installed this [[At least 100 years ago|since Flash came out]], no one will be able to use your user-programmable Pokedex (only 500MB!)


{{quote|Java is high performance. By high performance we mean adequate. By adequate we mean slow.|[http://www.mrbunny.com/ Mr. Bunny]}}
{{quote|Java is high performance. By high performance we mean adequate. By adequate we mean slow.|[http://www.mrbunny.com/ Mr. Bunny]}}
Line 27: Line 22:
* fool you with bullshit millisecond measurements. "Who are you going to believe, me, or your lying eyes?"
* fool you with bullshit millisecond measurements. "Who are you going to believe, me, or your lying eyes?"


Any version of Java released in the past 10 years requires the user to download a 110 megabyte file (compared to the 70 meg download for [[Shit Nobody Cares About|Microsoft's .NET Framework]]). Java web applets run in a [[sandbox]] and unless your applet is [[Internet license|signed]], it [[H4x|can't even access your clipboard]] but nobody uses Java applets anyway.
Any version of Java released in the past 10 years requires the user to download a 110 megabyte file (compared to the 70 meg download for [[Shit Nobody Cares About|Microsoft's .NET Framework]]) which then tries to install the [[Internet Explorer|Ask Toolbar]]. Good job, Oracle. Java web applets run in a [[sandbox]] and unless your applet is [[Internet license|signed]], it [[H4x|can't even access your clipboard]] but nobody uses Java applets anyway.


Since Java is the all-ruling and most powerful language in the universe, one might think that was is easy to learn. He would be right. Even [[Teachers|half-assed morons]] can learn how to do it. Java isn't about creating something from scratch, its just an intricate [[Copypasta|copy and paste]] program.
Since Java is the all-ruling and most powerful language in the universe, one might think that was is easy to learn. He would be right. Even [[Teachers|half-assed morons]] can learn how to do it. Java isn't about creating something from scratch, its just an intricate [[Copypasta|copy and paste]] program.
== Developing a GUI in Java==
Java has two GUI namespaces, which are AWT and Swing.
use swing for making your app look like java apps. when you use swing user will see the same components in all platforms
use awt for making your app look like the OS default apps. when you use this type of components, using the software on the OS you have not designed your software for, will shit bricks because defaults components have different borders and shit.
you are using Java for OS independence, so you, like all other java developers, will use swing components. After testing your software, you will see how slow Java works. Java itself might be stable, but the difficulty of programming makes the programmer ignore all exception handling (too time consuming), so the software will eventually be buggy in some way.
Plus, the shitty garbage collector that most JVMs use will randomly freeze your java app(let) for 2 seconds, as it stops everything to pathetically try to stop whatever memory leaks are occuring. The sad thing is, the garbage collector will catch maybe 90% of those leaks from happening, the other 10% will eventually crash the system.


== Why Use Java? ==
== Why Use Java? ==
Java is platform independent, like all its competitors C#, php, asp.net,asp, C, C++, Phyton, etc..
{{quote|Saying that Java is nice because it works on all OS's is like saying that anal sex is nice because it works on all genders.|A [[.Net]] programmer}}
The only logical use of Java is <strike>building browser games which use Java applets today</strike> creating [[COBOL|J2EE]] payroll applications that run on some backend server for some soulless megacorp. Period.
 
Java is [[bullshit|platform independent]], like all its competitors [[Shit nobody cares about|C#, PHP, ASP.NET, ASP, C, C++, Python, etc...]]
The only logical use of Java is building browser games which use Java applets today and to get on [[Oracle Corporation|Larry]]'s good side since they fucked MySQL. Period.


== Hello World! I'm a program that is useless! ==
==Using Java==
=== Hello World! I'm a program that is useless! ===
This is the layout of a basic "Hello World" in Java:
This is the layout of a basic "Hello World" in Java:
<pre style="margin-right:220px;">
<pre style="margin-right:220px;">
Line 78: Line 70:
   }
   }
</pre>
</pre>


Instead of using static methods they might even go further and create so called singleton classes which do the EXACT samething but instead they don't have the static declaration.  
Instead of using static methods they might even go further and create so called singleton classes which do the EXACT samething but instead they don't have the static declaration.  
Line 85: Line 76:


The only case they let you to use static methods is the mathematical functions such as sin,cos,sqrt. The reason they let you do is, that they forgot to make the Math class singleton during the development of java. It is rumored that Math class would be a singleton either but some of the java developers said: "OK guys.. Object Oriented.. nice.. but.. what the f*ck are we doing here?? aren't we going too stupid?" Than they used static methods. Later those developers quited java and Math class became one of the few classes that used static methods.
The only case they let you to use static methods is the mathematical functions such as sin,cos,sqrt. The reason they let you do is, that they forgot to make the Math class singleton during the development of java. It is rumored that Math class would be a singleton either but some of the java developers said: "OK guys.. Object Oriented.. nice.. but.. what the f*ck are we doing here?? aren't we going too stupid?" Than they used static methods. Later those developers quited java and Math class became one of the few classes that used static methods.


An example of a stupid "singleton" helloworld:
An example of a stupid "singleton" helloworld:
Line 118: Line 108:
</pre>
</pre>


== Trolling Java [[Fanboy|Fanboys]] ==
=== Developing a GUI in Java===
Much like [[Apple]], Java has a user base who would die defending it. These people like to say "it's [[Bullshit|just as fast as C]]" and "it's not slow it only [[Truth|starts slow]]". These people are ridiculously easy to troll because almost anything you can say about their sorry excuse for a programming language will make them [[butthurt]].
<center><youtube>gR1PujzQ53Q</youtube></center>
Here are a few ways to get [[lulz]] from Java "programmers":
Java has two GUI packages, which are AWT and Swing.
Use Swing for...
*Making your app look like legitimate Java applications.
*Actually, you can change how it looks in code, but the programs end up looking like shit for those lazy Java programmers who don't want to.  But since you're using Java, what do you expect?
*When you use Swing, the poor user will see the same components in all platforms, which is great.
*If you, the programmer, like putting a "J" in front of EVERY. FREAKING. THING.  No, seriously.  When you have a nice regular "Frame" in AWT, you have a stinking "JFrame" in Swing.  Where the heck did the "J" come from?  This is proof that James Gosling, the creator of Java, really likes "J"s.
*Swing was originally made as an extension package.  Not legit at all. This means that back in the old days, people had to go off and download something extra to make Swing run.  That's why it has an "x" on the package name ("javax.swing") instead of just the "java".<br>
Use AWT for...
*Making your app look like the OS default apps.
:*So when you run it on a Mac, you make it look like Steve Job's thing, and when you run it on a Windows, it looks stupid.
*When you want your program to look retarded if it gets used on an OS you didn't design it for.<br><br>
Since you, the hapless programmer, are using Java for OS independence, you, like all other Java developers, will use Swing components. After testing your software, you will see how slow Java works. Java itself might be stable, but the difficulty of programming makes the programmer ignore all exception handling (too time consuming), so the software will eventually be buggy in some way.  Unless, of course, you spend [[over 9000]] years debugging your code. Which is exactly what James Gosling intended.  Use C# instead!
 
=== The Reflection API ===
<center><youtube>b-Cr0EWwaTk</youtube></center>
<i>NOTE: This section is under construction.  Come back later for more lulz.</i>


* Say '''interpreter'''. They hate this word, they like ''virtual machine'' since it sounds cool and futuristic while ''interpreter'' is just a program that evaluates script.
The Reflection API is one of the few elements of Java that was not jacked from another language and passed off as an original feature. It is Java's method of introspection, which means that while your program is running, it can check all sorts of [[shit|fun stuff]] about your program. In short, it is the programming equivalent of licking your own balls. Using the Reflection API, you can do all sorts of fun stuff like getting the code for the statement you're running!  What fun!  This virus conveniently takes the form of a method found in every object in Java (<code>getClass()</code>), so you can stare at your own ugly code any time you want.
* Ask why in such a fast language, nobody ever wrote a video player or [[Minecraft|a game]].
* Point out that everyone else uses [[php]] for web apps.
* Point out that everyone else uses [[C]] for desktop apps.
* Ask where to find affordable Java hosting.
* Mention that Eclipse IDE is now using GCJ to convert their Java into [[machine code]] so it will run faster.
* Join a Java IRC [[chan]] and ask for help with GCJ, tell people it's faster.
* Write a [http://arstechnica.com/tech-policy/news/2010/08/oracle-sues-google-over-use-of-java-in-android-sdk.ars java interpreter that is not slow]. OMG if it's not a resource hog <s>Sun</s> Oracle won't be able to sell the new ''SparkXXXIV Genitalia'' 800 core processor.
* Create another programming language and give it the same name.


{{quote|We did [[JavaScript]] to try to be an intermediate bridge between [[HTML]] and Java. I got in huge fights with [[Sun]] over this. They got mad. Then I told them we wanted to [[Win|name it JavaScript]], and that made them even [[You Mad|madder]].|Marc Andreessen on [[doing it right]] ([http://www.zdnet.com.au/andreessen-php-succeeding-where-java-isn-t-139218171.htm sauce])}}
TL;DR: Don't use introspection. You'll crash physics.


== Restarting the VM ==
=== Restarting the VM ===
If you use Java shared hosting and you can't be bothered to open a ticket just to get the server restarted (who has time for that anyway?) You can restart the virtual machine any time you want using this slick little piece of java code:
If you use Java shared hosting and you can't be bothered to open a ticket just to get the server restarted (who has time for that anyway?) You can restart the virtual machine any time you want using this slick little piece of java code:


Line 143: Line 140:
The [[Admin|admins]] will admire your [[Dumb|cleverness]] and [[ban|appreciate]] you for not opening tickets every time you need a restart. <small>Disclamer: [[Skript kiddie|I didn't discover this]]</small>
The [[Admin|admins]] will admire your [[Dumb|cleverness]] and [[ban|appreciate]] you for not opening tickets every time you need a restart. <small>Disclamer: [[Skript kiddie|I didn't discover this]]</small>


== Lack of Unsigned Numbers ==
=== Boolean literals - true and false ===
There is no such thing as unsigned numeric values in Java because Sun thought they would be too difficult for programmers to grasp. This is the intelligence level that Java is built around.
 
== Commenting ==
<strike>Fuck commenting</strike> No, in Java, commenting fucks you. If you're forced to use Javadoc, your comments will dwarf your code, sometimes by a factor of three to one.
 
== Type Bullshit ==
Java implements strict typing yet hypocritically has loose type casting, so adding two '''bytes''' with a value of 1 will result in an '''int''', not a '''short''', which is the next storage type above byte. If you want to store an unsigned byte, you better use an int and do some magic <strike>operator overloading</strike> add/sub/mul/div function gymnastics for the math to work. Do you like typing? Do you know what RSI means? You will when you're pigeonholed as a Java programmer.
 
== Boolean literals - true and false ==
 


The two values are written with the reserved words true and false.
The two values are written with the reserved words true and false.
codded as:
coded as:


<b style="color:#2E8B57;font-size:103%;">boolean</b> butthurt;
<b style="color:#2E8B57;font-size:103%;">boolean</b> butthurt;
Line 166: Line 153:
<b style="color:#2E8B57;font-size:103%;">boolean</b> butthurt = <span style="color:#FF00FF">true</span>;
<b style="color:#2E8B57;font-size:103%;">boolean</b> butthurt = <span style="color:#FF00FF">true</span>;


== Loops ==
== Trolling Java [[Fanboy|Fanboys]] ==
Much like [[Apple]], Java has a user base who would die defending it. These people like to say "it's [[Bullshit|just as fast as C]]" and "it's not slow it only [[Truth|starts slow]]". These people are ridiculously easy to troll because almost anything you can say about their sorry excuse for a programming language will make them [[butthurt]].
Here are a few ways to get [[lulz]] from Java "programmers":
 
* Say '''interpreter'''. They hate this word, they like ''virtual machine'' since it sounds cool and futuristic while ''interpreter'' is just a program that evaluates script.
* Ask why in such a fast language, nobody ever wrote a video player or [[Minecraft|a game]].
* Point out that everyone else uses [[php]] for web apps.
* Point out that everyone else uses [[C]] for desktop apps.
* Ask where to find affordable Java hosting.
* Mention that Eclipse IDE is now using GCJ to convert their Java into [[machine code]] so it will run faster.
* Join a Java IRC [[chan]] and ask for help with GCJ, tell people it's faster.
* Write a [http://arstechnica.com/tech-policy/news/2010/08/oracle-sues-google-over-use-of-java-in-android-sdk.ars java interpreter that is not slow]. OMG if it's not a resource hog <s>Sun</s> Oracle won't be able to sell the new ''SparkXXXIV Genitalia'' 800 core processor.
* Create another programming language and give it the same name.
 
{{quote|We did [[JavaScript]] to try to be an intermediate bridge between [[HTML]] and Java. I got in huge fights with [[Sun]] over this. They got mad. Then I told them we wanted to [[Win|name it JavaScript]], and that made them even [[You Mad|madder]].|Marc Andreessen on [[doing it right]] ([http://www.zdnet.com.au/andreessen-php-succeeding-where-java-isn-t-139218171.htm sauce])}}
 
=== Loops ===


if loop- if (condition) = true, do code.
if loop- if (condition) = true, do code.
Line 238: Line 241:
This will print: 0
This will print: 0


== Comparison operators ==
=== Comparison operators ===
[[Image:Pouring_coffee.jpg|thumb|If you write in Java, you'll have time to make a pot of this while your code is compiling.]]
[[Image:Pouring_coffee.jpg|thumb|If you write in Java, you'll have time to make a pot of this while your code is compiling.]]


Line 259: Line 262:


6 <= 24 is true.
6 <= 24 is true.
OP == fag is true


6 == 24 is false.
6 == 24 is false.
Line 268: Line 273:
6 != 24 is true.
6 != 24 is true.


== Logical operators ==
=== Logical operators ===


Logical operators are like an extension of comparison operators.
Logical operators are like an extension of comparison operators.
Line 316: Line 321:
This will print the statement since !(i>3) is actually true, so both conditions are now true.
This will print the statement since !(i>3) is actually true, so both conditions are now true.


==Memory allocation and garbage collection==
===Memory allocation and garbage collection===
 
What? You are too lazy to tediously free() all your mallocs()?
 
== Problems ==
=== Lack of Unsigned Numbers ===
There is no such thing as unsigned numeric values in Java because Sun thought they would be too difficult for programmers to grasp. This is the intelligence level that Java is built around.
 
=== Commenting ===
Fuck commenting.
 
What the above statement means is that since it was featured on the web buttplug [[xkcd]] (http://xkcd.com/156/), '''commenting is retarded'''.
 
=== Type Bullshit ===
Java implements strict typing yet hypocritically has loose type casting (like your mom's horse dick), so adding two '''bytes''' with a value of 1 will result in an '''int''', not a '''short''', which is the next storage type above byte. If you want to store an unsigned byte, you better use an int and do some magic <strike>operator overloading</strike> add/sub/mul/div function gymnastics for the math to work.
 
===State of Java===


What? You are too <strike>lazy</strike> stupid to tediously free() all your mallocs()? Instead, let a shitty garbage collector do it at random intervals while it locks up everything for 2 seconds. And the java app you outsourced to India will still leak memory anyway. But I thought GC was supposed to take care of that? That's 90% true! It's the other 10% that will get you.
As the use of this useless language is dying, many people often use it to make shitty ass websites. Example:
[http://www.hooverhoops.com]
 
==Things Programmed Using Java==
*[[Minecraft|Terraria]]
*[[Pr0n]]
*[[Niggers]]
*[[Steve Jobs]]
*[[16 Year Old Girls]]. What a demonstration of how retarded Java is.
*[[Minecraft]]


== See Also ==
== See Also ==
* [[Python]] a superior object-oriented language
* [[Python]] a superior object-oriented language
* [[Camel|CamelCase]] TheAnnoyingWayJavaProgrammersUseAbsurdlyLongFunctionNamesWithoutUsingTheUnderscoreCharacter
* [[CamelCase]] TheAnnoyingWayJavaProgrammersUseAbsurdlyLongFunctionNamesWithoutUsingTheUnderscoreCharacter


==External links==
==External links==
Line 330: Line 360:
*[http://www.javarmi.com Java Learning And Tutorial]
*[http://www.javarmi.com Java Learning And Tutorial]


{{programming}}
{{softwarez}}
[[Category: Softwarez]]
[[Category: Softwarez]]
[[Category: Internets Phenomena]]
[[Category: Internets Phenomena]]

Latest revision as of 06:10, 10 August 2024

Fact Cat says:
JavaScript is not Java. If you were looking for Javascript, you might want to look here, you ignorant fuck.


Java is an interpreted language which is unique in that it includes a pretend compiler so that Java programmers can feel like they're using a grownup programming language. It is object oriented and has automatic garbage collection to make it as easy as possible to allocate memory.

Java is like Alzheimers: it starts slow and eventually takes away all of your memory. Something Java fans like to talk about is the JIT compiler which eventually does turn Java into native code but only after it's been interpreted 10,000 times. By that time the program has probably already crashed with an out of memory error. Programming in Java drives most hackers permanently insane. Evidence of this can easily be obtained by attempting to comprehend the content of this website.

Java is notable (along with Flash) for being one of the few technologies that allows Alan Turing to pwn your browser. Also of note is that Java is one of the most bloated languages with a minimum of twelve lines needed to do something as complex as print "Hello" on the screen.

Java is like C for people who are too pussy to do real programming. Instead of creating actual fucking programs anyone can run on any computer, one must have a separate interpreter installed on their computer in order to run the bytecode, which is what Java calls code that's been "compiled". Unfortunately, since no one has installed this since Flash came out, no one will be able to use your user-programmable Pokedex (only 500MB!)

   
 
Java is high performance. By high performance we mean adequate. By adequate we mean slow.
 

 
 

Mr. Bunny

Java GUI applications are dogshit slow to load and run, and never feel right. To deflect criticism and hide this shittiness from decent, honest folk who are just trying to get some work done quickly, Java developers:

  • use splash screens to mask the load time (they call this a "time warp.")
  • use external, non-Java splash screen software when even the previous item fails at fooling the user (srsly)
  • blame the Virtual Machine vendor
  • blame the user for not fiddling with his Virtual Machine settings
  • blame the user for not already having the JVM cached in memory. "What are you, a fucking retard?"
  • use third-party toolkits
  • fool you with bullshit millisecond measurements. "Who are you going to believe, me, or your lying eyes?"

Any version of Java released in the past 10 years requires the user to download a 110 megabyte file (compared to the 70 meg download for Microsoft's .NET Framework) which then tries to install the Ask Toolbar. Good job, Oracle. Java web applets run in a sandbox and unless your applet is signed, it can't even access your clipboard but nobody uses Java applets anyway.

Since Java is the all-ruling and most powerful language in the universe, one might think that was is easy to learn. He would be right. Even half-assed morons can learn how to do it. Java isn't about creating something from scratch, its just an intricate copy and paste program.

Why Use Java?

   
 
Saying that Java is nice because it works on all OS's is like saying that anal sex is nice because it works on all genders.
 

 
 

—A .Net programmer

Java is platform independent, like all its competitors C#, PHP, ASP.NET, ASP, C, C++, Python, etc... The only logical use of Java is building browser games which use Java applets today and to get on Larry's good side since they fucked MySQL. Period.

Using Java

Hello World! I'm a program that is useless!

This is the layout of a basic "Hello World" in Java:

   public class HelloWorld
   {
      public static void main(String[] args)
      {
       System.out.println("Hello World! I'm a useless program!");
      }
   }

Lets look at this a little deeper(eww). The first line is the class heading. This program is "public", which means it is avaliable to other programs for their use. This heading creates a "class" called helloWorld. "helloWorld" is an identifier, which means the programmer names it, so it doesn't matter what it is, as long as it doesn't contain numbers or spaces.

The bracket on line 2 contains the class.

The next line contains the method, called "main". Again, public means the same as above, but for the method, instead of the class. void means that it doesn't return a value, and main is the name of the method. (Just take my word for it, you have to write it this way until you become more advanced in Java).

The next line calls the "System.out.println" method, which prints the text in the double quotes to the console. You have a ";" at the of a statement to tell the compiler to stop for that statement.

Then you end with two brackets.

Of course, any java weenie will tell you that this is totally wrong. Static methods are bad. As are using the "no-name" package. Also, putting opening braces on a new line is completely retarded, as any non-retarded person knows. What you really need is something like:

  
   package com.mydomain.sampleprograms;
   
   public class HelloWorld {
      public static void main(String[] args) {
         new HelloWorld().helloWorld();
      }
   
      protected void helloWorld()   {
          System.out.println("Hello World! I'm a useless program!");
      }
   }

Instead of using static methods they might even go further and create so called singleton classes which do the EXACT samething but instead they don't have the static declaration.

If you use static methods the java weenie will "blame" you of having a C programer's mind. (As if it is something to be ashamed of)

The only case they let you to use static methods is the mathematical functions such as sin,cos,sqrt. The reason they let you do is, that they forgot to make the Math class singleton during the development of java. It is rumored that Math class would be a singleton either but some of the java developers said: "OK guys.. Object Oriented.. nice.. but.. what the f*ck are we doing here?? aren't we going too stupid?" Than they used static methods. Later those developers quited java and Math class became one of the few classes that used static methods.

An example of a stupid "singleton" helloworld:

  
   package com.mydomain.sampleprograms;

   public class HelloWorld {

      private static HelloWorld hw;

      public static void main(String[] args) {
         System.out.println(HelloWorld.getInstance());
      }
   
      public static HelloWorld getInstance(){
         if(hw == null){
            hw = new HelloWorld();
         }
         return hw;            
      }
 
      private HelloWorld()   {
          //constructor became entirely useless 
          //but whatever static methods are "bad"
      }

      public String toString(){
          return "Hello World! I'm a useless program!";
      }
   }

Developing a GUI in Java

Java has two GUI packages, which are AWT and Swing. Use Swing for...

  • Making your app look like legitimate Java applications.
  • Actually, you can change how it looks in code, but the programs end up looking like shit for those lazy Java programmers who don't want to. But since you're using Java, what do you expect?
  • When you use Swing, the poor user will see the same components in all platforms, which is great.
  • If you, the programmer, like putting a "J" in front of EVERY. FREAKING. THING. No, seriously. When you have a nice regular "Frame" in AWT, you have a stinking "JFrame" in Swing. Where the heck did the "J" come from? This is proof that James Gosling, the creator of Java, really likes "J"s.
  • Swing was originally made as an extension package. Not legit at all. This means that back in the old days, people had to go off and download something extra to make Swing run. That's why it has an "x" on the package name ("javax.swing") instead of just the "java".

Use AWT for...

  • Making your app look like the OS default apps.
  • So when you run it on a Mac, you make it look like Steve Job's thing, and when you run it on a Windows, it looks stupid.
  • When you want your program to look retarded if it gets used on an OS you didn't design it for.

Since you, the hapless programmer, are using Java for OS independence, you, like all other Java developers, will use Swing components. After testing your software, you will see how slow Java works. Java itself might be stable, but the difficulty of programming makes the programmer ignore all exception handling (too time consuming), so the software will eventually be buggy in some way. Unless, of course, you spend over 9000 years debugging your code. Which is exactly what James Gosling intended. Use C# instead!

The Reflection API

NOTE: This section is under construction. Come back later for more lulz.

The Reflection API is one of the few elements of Java that was not jacked from another language and passed off as an original feature. It is Java's method of introspection, which means that while your program is running, it can check all sorts of fun stuff about your program. In short, it is the programming equivalent of licking your own balls. Using the Reflection API, you can do all sorts of fun stuff like getting the code for the statement you're running! What fun! This virus conveniently takes the form of a method found in every object in Java (getClass()), so you can stare at your own ugly code any time you want.

TL;DR: Don't use introspection. You'll crash physics.

Restarting the VM

If you use Java shared hosting and you can't be bothered to open a ticket just to get the server restarted (who has time for that anyway?) You can restart the virtual machine any time you want using this slick little piece of java code:

Object[] o = null; for(;;) { o = new Object[] {o}; }

The admins will admire your cleverness and appreciate you for not opening tickets every time you need a restart. Disclamer: I didn't discover this

Boolean literals - true and false

The two values are written with the reserved words true and false. coded as:

boolean butthurt;

butthurt = true;

or all at once:

boolean butthurt = true;

Trolling Java Fanboys

Much like Apple, Java has a user base who would die defending it. These people like to say "it's just as fast as C" and "it's not slow it only starts slow". These people are ridiculously easy to troll because almost anything you can say about their sorry excuse for a programming language will make them butthurt. Here are a few ways to get lulz from Java "programmers":

  • Say interpreter. They hate this word, they like virtual machine since it sounds cool and futuristic while interpreter is just a program that evaluates script.
  • Ask why in such a fast language, nobody ever wrote a video player or a game.
  • Point out that everyone else uses php for web apps.
  • Point out that everyone else uses C for desktop apps.
  • Ask where to find affordable Java hosting.
  • Mention that Eclipse IDE is now using GCJ to convert their Java into machine code so it will run faster.
  • Join a Java IRC chan and ask for help with GCJ, tell people it's faster.
  • Write a java interpreter that is not slow. OMG if it's not a resource hog Sun Oracle won't be able to sell the new SparkXXXIV Genitalia 800 core processor.
  • Create another programming language and give it the same name.
   
 
We did JavaScript to try to be an intermediate bridge between HTML and Java. I got in huge fights with Sun over this. They got mad. Then I told them we wanted to name it JavaScript, and that made them even madder.
 

 
 

—Marc Andreessen on doing it right (sauce)

Loops

if loop- if (condition) = true, do code.


int i = 0;

if (i<5){
  System.out.println(i);
}


This code checks to see if variable i is less than 5, if it is print out i's value. This code will print: 0

for loop- for (A;B;C){ statements; } A-initialization B-termination C-increment Example:

for (int i=0;i<5;i++){
  System.out.println(i);
}

This code sets variable i to start at 0, check if its less then 5, if it is run statements and increment i by one. This will print:

                0
                1
                2
                3
                4

while loop- while (condition) do statements

This one is pretty straight forward, if the condition is true, do the statements. Example:

int i=0;

while(i<5){
  System.out.println(i++);
}

This will print:

                0
                1
                2
                3
                4

do while loop- do statements while (condition)

Very similar to the while loop, but the do while loop always executes once since it evaluates the condition after the statement. A while will never run if the condition is false.

do {
   Statements;
}
while(condition);

Do the statement until the condition equals true.

Example:

int i=0;
do {
   System.out.println(i);
} while (i>5);

Note that the condition is false and will never be true from this code. So the statement will only run once. This will print: 0

Comparison operators

If you write in Java, you'll have time to make a pot of this while your code is compiling.

Comparison operators are used to compare two primitive values (rarely objects). The comparison operators are:

< less than

<= less than or equal to

== equal to

> greater than

>= greater than or equal to

!= not equal to

6 < 24 is true

6 <= 24 is true.

OP == fag is true

6 == 24 is false.

10 >= 10 is true.

10 > 10 is false.

6 != 24 is true.

Logical operators

Logical operators are like an extension of comparison operators. The logical operators are:

&& and

|| or

Example: a && b and The result is true only if both a and b are true.

a || b or The result is true if either a or b is true.

You can also use the not operator. !a not true if a is false and false if a is true.

int i=0;

int j=4;

if (i>3||j<=4){

System.out.println("hfsdkjhs");

}

This will print the statement because the or operator only requires one of the conditions to be true.

if (i>3&&j<=4){

System.out.println("hfsdkjhs");

}

This wont print since the and operator requires all the conditions to be true.

if (!(i>3)&&j<=4){

System.out.println("hfsdkjhs");

}

This will print the statement since !(i>3) is actually true, so both conditions are now true.

Memory allocation and garbage collection

What? You are too lazy to tediously free() all your mallocs()?

Problems

Lack of Unsigned Numbers

There is no such thing as unsigned numeric values in Java because Sun thought they would be too difficult for programmers to grasp. This is the intelligence level that Java is built around.

Commenting

Fuck commenting.

What the above statement means is that since it was featured on the web buttplug xkcd (http://xkcd.com/156/), commenting is retarded.

Type Bullshit

Java implements strict typing yet hypocritically has loose type casting (like your mom's horse dick), so adding two bytes with a value of 1 will result in an int, not a short, which is the next storage type above byte. If you want to store an unsigned byte, you better use an int and do some magic operator overloading add/sub/mul/div function gymnastics for the math to work.

State of Java

As the use of this useless language is dying, many people often use it to make shitty ass websites. Example: [1]

Things Programmed Using Java

See Also

  • Python a superior object-oriented language
  • CamelCase TheAnnoyingWayJavaProgrammersUseAbsurdlyLongFunctionNamesWithoutUsingTheUnderscoreCharacter

External links


Java is part of a series on Programming.

[2 L337 4 MEEnter the Matrix]

ADAAssemblyCC++COBOLDebugDOSErlangErrorFdiskFortranIntegerJavaLOLCodeMachine CodeMatlabMIRC ScriptMUMPSOpen SourcePerlPHPProgramming languagePythonQBASICRuby on RailsScratchSSHVisual Basic

Hacks

Firefox XPS IRC AttackSafari XPS Attack Sandworm

Programmers

Bill GatesLinus TorvaldsWeevGoatse SecurityTerry DavisTheo de Raadt

Other Topics

Operating systemWarezNotepadIs not a bug, it's a featureDatabase Error

Java is part of a series on

Softwarez

Visit the Softwarez Portal for complete coverage.