[Boards: 3 / a / aco / adv / an / asp / b / bant / biz / c / can / cgl / ck / cm / co / cock / d / diy / e / fa / fap / fit / fitlit / g / gd / gif / h / hc / his / hm / hr / i / ic / int / jp / k / lgbt / lit / m / mlp / mlpol / mo / mtv / mu / n / news / o / out / outsoc / p / po / pol / qa / qst / r / r9k / s / s4s / sci / soc / sp / spa / t / tg / toy / trash / trv / tv / u / v / vg / vint / vip / vp / vr / w / wg / wsg / wsr / x / y ] [Search | Free Show | Home]

Why is Java the best language ever created?

This is a blue board which means that it's for everybody (Safe For Work content only). If you see any adult content, please report it.

Thread replies: 32
Thread images: 4

File: java.png (3KB, 275x183px) Image search: [Google]
java.png
3KB, 275x183px
>>
>>58835638
most sun technologies were godtier
>>
>>58835638
I like it because your code will work on every platform without many changes
>>
>>58835638
Because how else would you code Enterprise FizzBuzz™?

interface FizzBuzzable {
public int value();
public String doFizzBuzz();
}

final class FizzBuzzableNumber implements FizzBuzzable {
private final int num;
public FizzBuzzableNumber(int n) {
this.num = n;
}
public final int value() {
return this.num;
}
public final String doFizzBuzz() {
return new Integer(this.num).toString();
}
}

abstract class DivisibleNumber implements FizzBuzzable {
protected final FizzBuzzable original;
public DivisibleNumber(FizzBuzzable origin) {
this.original = origin;
}
public final int value() {
return this.original.value();
}
public final String doFizzBuzz() {
String fizzBuzzed = new String("");
if (this.isDivisible()) {
fizzBuzzed += this.fizzBuzzing();
} else {
fizzBuzzed += this.original.doFizzBuzz();
}
return fizzBuzzed;
}
protected abstract boolean isDivisible();
protected abstract String fizzBuzzing();
}

final class NumberDivisibleByThree extends DivisibleNumber {
public NumberDivisibleByThree(FizzBuzzable origin) {
super(origin);
}
protected final String fizzBuzzing() {
return "Fizz";
}
protected final boolean isDivisible() {
return ((this.value() % 3) == 0);
}
}

final class NumberDivisibleByFive extends DivisibleNumber {
public NumberDivisibleByFive(FizzBuzzable origin) {
super(origin);
}
protected final String fizzBuzzing() {
return "Buzz";
}
protected final boolean isDivisible() {
return ((this.value() % 5) == 0);
}
}

final class NumberDivisibleByThreeAndFive extends DivisibleNumber {
public NumberDivisibleByThreeAndFive (FizzBuzzable origin) {
super(origin);
}
protected final String fizzBuzzing() {
return "Fizz Buzz";
}
protected final boolean isDivisible() {
return (((this.value() % 3) + (this.value() % 5)) == 0);
}
}
>>
>>58835755

But wait, there's more!

public class Main {
public static void main(String[] args) {
for (int i = 1; i <= 100; ++i) {
System.out.print(
new NumberDivisibleByThreeAndFive(
new NumberDivisibleByFive(
new NumberDivisibleByThree(
new FizzBuzzableNumber(i)
)
)
).doFizzBuzz()
);
if (i < 100) System.out.print(", ");
}
}
}
>>
File: 1486145434614.jpg (26KB, 400x462px) Image search: [Google]
1486145434614.jpg
26KB, 400x462px
>>58835755
>>58835765
>no AbstractFizzBuzzableFactory
>no DivisibleStrategyProviderImpl
do you even enterprise ?
>>
>>58835755
>>58835765
Thanks anons. I needed the laugh.
>>
>>58835827

Feel free to refactor for further enterprise, anon.
>>
>>58835638
2017 C++ still memory unsafe,no modules,no package mananger.

Java still compile code 20 years ago.
Python get disaster on 2 to 3 transition.
Java make big projects.
JVM becomes host dozens new languages.
Java ecosystem is gigant.
>>
>>58836184
Where can I get some brain fluid?
>>
I don't like strict typing. Is something wrong with me?
>>
>>58836398
yes.
>>
>>58835755
>no XML comments anywhere
>multiple objects in one file
>methods before attributes
>magic numbers instead of constants

you're fired!
>>
>>58837143

>no XML comments anywhere
I-I was limited to 2,000 characters, a-anon...

>multiple objects in one file
>methods before attributes
>magic numbers instead of constants
I-I'm so s-sorry...
>>
File: raj.jpg (355KB, 1532x2038px) Image search: [Google]
raj.jpg
355KB, 1532x2038px
t. pajeet
>>
>>58835638
Java is a patent trap
>>
>>58837249
H-haha no, nice paranoia y-you got there, but no, I can assure you, I work at S- I-I mean with Sun technologies, have worked, for a while, a-and I can assure y-you that we - uh... they would never sue anyone for ever using Java haha nice try though shill.
>>
it's the C# of the non M$ world. No thanks, Jeff.
>>
public class Main {
public static void main(String[] args) {
Rectangle a = new Rectangle(3,4);
}
}

public class Rectangle {
private final Integer width;
private final Integer height;

public Rectangle(Integer width,Integer height) {
this.width = width;
this.height = height;
}

public Integer circumference() {
return width * width + height * height;
}

public Integer area() {
return width * height;
}

public Double diagonal() {
return Math.sqrt(circumference());
}

public Boolean overlaps(Rectangle other) {
return width >= other.width && height >= other.height;
}
}


Rate my coding style please.
>>
>>58837665

http://laufer.cs.luc.edu/teaching/313/handouts/practice-midterm
>>
>>58837734
>the length of the rectangle along the x axis is given by xlength

That's called width.
>>
>>58836398
Yes.
>>
Verbose shit.
>>
>>58837793
The guy's German.
>>
>>58835638
*cough* Android *cough*
>>
File: vader.jpg (36KB, 500x329px) Image search: [Google]
vader.jpg
36KB, 500x329px
>>58835755
>>58835765
Noyce!
>>
>>58837665
>no accessors
>no hashcode, equals, toString override
>no default constructor
>final attributes not in caps
>failed overlaps implementation

4/10 pls stick to lua for now
>>
>>58835638
How else would you develop for phones without spending a few hundred?
>>
>>58835755
fizz buzz woof
>>
>>58836398
Yes.
>>
>>58836398
No.
>>
It puts the poo in the loo.

And it takes up gratuitous amounts of RAM for no good reason.
Thread posts: 32
Thread images: 4


[Boards: 3 / a / aco / adv / an / asp / b / bant / biz / c / can / cgl / ck / cm / co / cock / d / diy / e / fa / fap / fit / fitlit / g / gd / gif / h / hc / his / hm / hr / i / ic / int / jp / k / lgbt / lit / m / mlp / mlpol / mo / mtv / mu / n / news / o / out / outsoc / p / po / pol / qa / qst / r / r9k / s / s4s / sci / soc / sp / spa / t / tg / toy / trash / trv / tv / u / v / vg / vint / vip / vp / vr / w / wg / wsg / wsr / x / y] [Search | Top | Home]

I'm aware that Imgur.com will stop allowing adult images since 15th of May. I'm taking actions to backup as much data as possible.
Read more on this topic here - https://archived.moe/talk/thread/1694/


If you need a post removed click on it's [Report] button and follow the instruction.
DMCA Content Takedown via dmca.com
All images are hosted on imgur.com.
If you like this website please support us by donating with Bitcoins at 16mKtbZiwW52BLkibtCr8jUg2KVUMTxVQ5
All trademarks and copyrights on this page are owned by their respective parties.
Images uploaded are the responsibility of the Poster. Comments are owned by the Poster.
This is a 4chan archive - all of the content originated from that site.
This means that RandomArchive shows their content, archived.
If you need information for a Poster - contact them.