[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]

Java #1

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: 60
Thread images: 3

File: javaisbeautiful_x2.png (108KB, 1230x193px) Image search: [Google]
javaisbeautiful_x2.png
108KB, 1230x193px
Why is java so beautiful?
>>
>Shit.shit.shit.shit.shit...
Oh and
>System.out.println
Jesus wtf...
>>
Where the hell is that exception going????
>>
>>59949057
No-where. Enterprise Java consists of throwing exceptions up the chain over and over.
>>
>>59949059
Truly a master piece
>>
>>59947917
I started using java hating the language, but it's kinda grown on me desu, it's not the best, but not that awful
>>
How do you make such a verbose language fit on a 80-column terminal?

inb4 2017 uneducated whining about how we have wider editors
>>
>>59950567
Line breaks
>>
>system.out.println
Why not simply echo or print?
>>
>>59951078
If you include several headers in C or C++ you literally never know where the function you call come from when you are reviewing Code. Therefore it's good to have an exact path in my opinion.
>>
>>59951144

C++ has namespaces and classes though.
>>
You call that beautiful?
That looks like absolute shit, mostly because you're not declaring assemblies, even though you're using them more than once.

Also:
>using the opening curved brackets in front of the method instead of inserting it as a newline
Ok retard, that's how you should do it, brackets belong to their own line if they're for example a Class, Method or whatever the fuck.
If it's a function like a while/if/for...etc block then the first brackets belong in front of the declaration.

Is it that hard?
>>
>>59947917
static void main(String args[]) {
System.out.println("Your are a piece of shit anaon.);
}
>>
>>59951859
oh i forget the access modiefier
public
>>
>>59947917
java is the best language around


Kappa LUL
>>
>>59951871
Nor providing an access modifier is its own modifier in java lol, it has has a different rule than public, private, and protected
>>
>>59951078
We use log4j and do log.info. but intellij has auto comolete you can just type sout or soutv. Whats sucks is Logger.getAnonymousLogger.i nfo();
>>
>>59947917
Main method throws an Exception, truly a work of beauty...woah....
>>
>>59949057
That one will go no where. The point of declaring thrown exceptions is so that the caller of said method is forced to handle the exception when they write their code. OP was being lazy with this one.
>>
>public static void main(String[] args)
No.
>>
>>59947917
Because C's vocal minority is too stupid to code in java.
>>
>>59947917
Verbose == Ugly, not beautiful
>>
>>59952204
lol

other way around bud
>>
Why is java fx so shit?
>>
What purpose does Java serve? I know it's used a lot in enterprise and is the main language for android apps but, assuming C is it's main competitor and C is faster...
>>
>Existence.Multiverse.Universe.Galaxy.System.Planet.Technology.Desktop.IO.Output.Function.Print.Language.Human.English("hello\n");
>>
>>59947917
Why the hell do you like the smell of burning CPUs?
>>
File: 1492343408997.jpg (17KB, 200x434px) Image search: [Google]
1492343408997.jpg
17KB, 200x434px
>>59951370
>bracket on new line
it's time to end yourself
>>
>>59952583
java is save. you really want a bunch of pajeets writing your shit in c? really`?
>>
>>59947917
object_type something = new object_type()


I don't know Java, can anyone explain the logic behind this?
It doesn't make sense to write
integer x = new float(...)

Why use the type twice?
>>
>>59952902
"new" (at least in C++) is dynamic memory allocation
That's why you need to declare the type you are going to use.
>>
File: end if.jpg (14KB, 320x167px) Image search: [Google]
end if.jpg
14KB, 320x167px
>When u have to declare the type three times in the same statement
>>
>>59952931
Yeah but shouldnt make
x = new integer(...)
or
integer x = new(...)

Make more sense? Can't the compiler easily infer the type from either the left or right side, instead of needing both?
>>
>>59952902
>>59952958
new is for objects and not for primitives
>>
>>59952583
Java is cross-platform, comes with everything you need to make cross-platform programs built in, and can be embedded in a webpage. It's really more a development suite than just a language.

Performance had to be sacrificed to allow greater expressivity; if you worry too much about the low level, you get trapped there. (This is also why object oriented programming is better than functional programming.)
>>
>>59952583
Curry provider for Pajeet.
>>
>>59952958
void* x;
x = new(1)


what did he mean by this
>>
>>59953125
>Performance had to be sacrificed
I am pretty sure Java programs are only like 1.3x slower than C programs nowadays, and faster than freepascal programs.
>>
>>59951144
>you literally never know where the function you call come from when you are reviewing Code. T
F2 in Qt Creator. F11 in Visual Studio. Faggit.
>>
>>59952958
It's like this guy doesn't even oop.

Parent* ptr = new Child();

This is valid, you need to get a little bit further in your intro to computer sci class before you get into objects and that fun stuff. I heard if we're extra good today, we get juice early!
>>
>>59953165
Horse shit, Java doesn't have void*.
More idio[ma]tic equivalent:
? x;
x = new ?(1);

i very much doubt this would compile but at least it LOOKS like something a java developer could conceivably understand
>>
>>59952583
>C is it's main competitor

What has this board become? Where are these people coming from?
>>
>>59953230
When i review code it's almost everytime online in plaintext.

>>59951208
Yes, but if you have static methods in c++ you can't Class.Method().
>>
>>59953233
>This is valid
Not inherently. Consider:
class Parent {};
class Child: public Parent {};
int main() {
Parent* x = new Child();
return 0;
}

If you compile this, you should get an error. Pointer types related by inheritance are only compatible if the derived type has a virtual destructor.
>>
>>59953381
pretty sure he was replying to a guy posting c++, and that guy was replying to someone posting something generic, which included c++
>>
>>59953432
why would I bother posting the entire class definition, just need to get the point across
>>
package com.seriouscompany.business.java.fizzbuzz.packagenamingpackage.impl;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.seriouscompany.business.java.fizzbuzz.packagenamingpackage.interfaces.FizzBuzz;
import com.seriouscompany.business.java.fizzbuzz.packagenamingpackage.interfaces.factories.FizzBuzzSolutionStrategyFactory;
import com.seriouscompany.business.java.fizzbuzz.packagenamingpackage.interfaces.strategies.FizzBuzzSolutionStrategy;

@Service
public class StandardFizzBuzz implements FizzBuzz {

private final FizzBuzzSolutionStrategyFactory _fizzBuzzSolutionStrategyFactory;

@Autowired
public StandardFizzBuzz(final FizzBuzzSolutionStrategyFactory _fizzBuzzSolutionStrategyFactory) {
super();
this._fizzBuzzSolutionStrategyFactory = _fizzBuzzSolutionStrategyFactory;
}

public void fizzBuzz(final int nFizzBuzzUpperLimit) {
final FizzBuzzSolutionStrategy mySolutionStrategy =
this._fizzBuzzSolutionStrategyFactory.createFizzBuzzSolutionStrategy();
mySolutionStrategy.runSolution(nFizzBuzzUpperLimit);
}

}
>>
>>59952853
inb4 you're that kind of retard that does lambda expressions in a single line, regardless of how long it is.
>>
>>59952583
Java's main competitor is C#. The purpose C fulfills is entirely incomparable; it's "faster" because it operates at a lower level of abstraction.
>>
>>59952583
Java is free and it is used everywhere for backends for enterprise software. Thays what i do for a livinf
>>
>>59951370

Putting the first bracket on a newline is worse than Raping 6000 Holocaust victims on 9/11
>>
>>59952583
>assuming C is it's main competitor
retard
>>
>>59953608
ur mum
>>
>>59951871

Default is package private, it's acceptable.
>>
>>59947917
Because you have very low standards of beauty
>>
>>59952583

Cross platform, write one run anywhere with garbage collection.

It's literally everywhere.
And C is only faster if you take the time to optimize it, which carries a cost - outside of that Java runs nearly on par with C++. For the most part hardware is fast enough now and the JVM does a good enough job that you don't need the extra performance.

Google's strategy is basically Python when you can, C when you must, and Java everywhere else.
>>
>>59947917
>not using main(String... args)
>not importing Scanner or File to make it look more verbose
>Using a scanner when you are just printing out the whole file
>>
>>59953562
>implying the holocaust happened
>>
>>59953788
>implying 9/11 happenend
>>
>>59953427
>When i review code it's almost everytime online in plaintext.
Found your problem.
Thread posts: 60
Thread images: 3


[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.