Java is a good language

Java is a good language
>prove me wrong

Other urls found in this thread:

msdn.microsoft.com/en-us/library/yhfk0thd.aspx
stackoverflow.com/questions/1700081/why-does-128-128-return-false-but-127-127-return-true-when-converting-to-integ
google.com/search?q=java integer 127&oq=java integer 127
twitter.com/NSFWRedditImage

bumperino

You need to create a class in order to write a hello world to screen.

You need to execute your software in a VM

you need technology to test

Simply adding properties would make it a lot better.

I dont prefer it but what do you like about it OP?

>import java.awt.net.ebean.factory.async.collections.AsyncFactory

Most normies use it.

Lel normie may may Reeeeeee xDD lel reddit frogposter
>>>/Facebook/
>>>/redditt/

>tripfag
>>>/reddit/

it's pretty good actually depending on the use-case

now get ready for this thread to be flooded by a billion Sup Forums shitters spamming "POO IN LOO XD" and other ebin Sup Forums maymays

in b4 "hello pajeet"

In what language can you write hello world to the screen without creating a file for the code to go in?

>>tripfag
>not namefag
>>>/reddit/

java is abandonware.

> Bean beanBeanBeanFactory = new (Bean) beanBeanfactory((beanFactory) beanbean Factory)

This, spring is garbage bloatware that acts as a shitty safety mechanism for bad programmers who don't know how to keep their classes organized and consistent.

...

only java EE is abandonware

print("Hello World")

Oracle

Though, DESU, I think they're doing good with MySQL

I prefer C#

...

Even C++ has properties.
msdn.microsoft.com/en-us/library/yhfk0thd.aspx

>class

>VC++

Is anyone hear familiar with Excel? I have a question and am about to pull my freaking hair out with this shit.

Why is (a1000 == b1000) false? They both have the same value.

class Program
{
public static void main(String[] args)
{
System.out.println("Hello World\n");
}
}


int main(int argc, char *argv[])
{
printf("Hello World\n");
}


I don't see what't so painful about that, it's not that much more setup.

"int" is primitive, and "Integer" isn't. When doing == you check if two objects point to the same instance. "Integer" has it's own integer cache for lower values (-128 to 127), so values higher aren't part of the cache and therefore point to a separate reference. If you did a1000.equals(b1000); you would get true.

stackoverflow.com/questions/1700081/why-does-128-128-return-false-but-127-127-return-true-when-converting-to-integ
if you want to read more or if I lost you.

>uses println
>adds new line character
>Hello World
>
>//input starts here
jej

You have to be 18+ to use this site.

Good : to be desired or approved of.
I hate Java and I do not approve of this post. Fuck you OP.

Could you enlighten me on why having such a cache that breaks uniformity of behavior is not retarded?

Java is obsolete and dying out.
Switch out while you can.

Java used to be really slow, but now with better VM and better hardware this is less of a problem.
Another problem with Java is that even for simple things you usually will write a lot of boilerplate code.
When a company evaluates the work of their programmers, if they use LOC metric, more code "seems" better to unaware managers, so the employee is praised.
Of course this doesn't mean it's good code.
What I really like about Java is that it has integrated classes for windows and graphics.
These days applications usually need to have some sort of UI, in other languages you have to use external libraries that may not be portable, in Java it is integrated into the language itself.
It is OOP and you don't have to think about memory managemeng, because garbage collector does it for you.
This is a +/- case, because the GC can run when you don't want it to making it seem like your application slows down and lags.
Sup Forums also doesn't like Java because it's known for being simple and easy to learn.
We only like hard things here, because it's challanging (usually).

>subjective claim
>prove
Sup Forums is full of shitposting autists as usual

>"Integer" has it's own integer cache for lower values (-128 to 127), so values higher aren't part of the cache and therefore point to a separate reference
holy shit that's retarded

People still use Java because it is portable, fast, well-known, and good at most things. In reality, Java's bad rap comes from applet malware and desktop applications. Confluence and Jira are both examples of great Java programs.

I always feel that way too, after using some other language for a long time.
>oh there was nothing wrong with java all langues have problems XD

Then after doing something with Java again, I end up ripping my anus because of how fucking insane it is.

I think it has to do with memory stacks, that range represents one byte and is probably stored in a quicker access memory point, and then larger values are stored in a different location. (More data storage = slower access speed). It actually is pretty smart for getting programs to run faster.

True. Go on ... ?

Java is still ~50% slower than equivalent C code

Integer is an object, int is a type. Comparing int to int would result true. But just like comparing Strings, comparing Integers (capitalized letter), will (not always) be false. If he did a1000.equals(b1000) it'd be true.

Thats because C is closer to hardware level. But that doesnt make C better. Go develop any usable application in C, and then realize you could have used a better language like java, or something else..

Well good think I'm not coding Hello Worlds over and over again.

Once your program gets much more complicated, the bulky java syntax will become very painful to read through and maintain, even though it's easier to implement most of the things when you're writing in java. Also memory overhead.

It's strict OOP and this sucks. You need to create classes for everything.

All of the popular Javascript VMs, Dart, the CLR, LuaJIT, CPython and PyPy do the same.

throws Exception

you can't opt out of the OOP

inb4 jsut use static,

its feels wrong user I want to have proper modules.

See There's a reason why it's -128 to 127. Either way, it wouldn't break if you followed convention and compared objects with .equals() instead of "==". Also, the link that I put there also has the reason why == is different than .equals()

python also has a integrated UI manager module, albeit a kinda shitty one.

Java is a bad language but it has the best tooling and VM.

/thread

On a broader note, could someone explain the problem with OOP? I've been working on a smallish project recently (a 2D flight sim to test collision avoidance), and modeling it as objects handled by a central coordinator (plus a graphical display) seemed the easiest way to go about it. Is the problem bloat associated with the paradigm, or have I just not learned the way of handling everything functionally?

Everything Java does, Scala can do better, and more.

You can safely ignore 99% of the complaints about OOP on Sup Forums. Most of the people here just discovered functional programming and have never written anything non-trivial in their entire neet lives.

I wrote a compiler in Haskell

The main argument against OOP is that is sometimes requires a lot of bloat and code to accomplish certain things that are much easier expressed with some functional ideas like Higher Order Functions.

If you read the book "Game Programming Patterns" in the first part of the book it revisits some patterns in the GoF book which is the iconic book on design patterns of OOP programs.

In some cases he shows how to do something in a functional way, and it's clear that it's much more concise compared the OO way which requires a ton of boilerplate.

So some problems are much more cleanly expressed in a functional way, and many people believe that by making your datastructures immutable you avoid a large class of problems in larger application development.

So being strictly OO in it's current form is restricting in a lot of cases, just like being stricly FP is restricting.

>When a company evaluates the work of their programmers, if they use LOC metric, more code "seems" better to unaware managers, so the employee is praised.
I quit reading here.

Scala is crap. Martin is smart but can't code for shit. Everything he touches inevitably needs to be completely rewritten (scala compiler and 95% of the standard library for example).

Hi Paul!

Fair enough, my program is in Python because I'm a babby so I avoided a lot of the restrictive patterns you see in Java. Mostly I just think the basic idea of encapsulating data and methods is a natural fit for some, well, objects, and either there's something really offensive about that or OOP implies something else.

Paul and Jason are objectively far smarter than everyone else in the Scala community.

that doesn't make it not retarded. The fact that there's a completely different behavior/convention for comparing Integers based on an arbitrary cutoff is horrible language design.

Even if it's to increase speed, it's still a solution to a problem that shouldn't exist, and not a very good solution at that.

Hey, I think Miles is pretty sharp too.

The people designing those VMs are far smarter than you will ever be. It's also expected behavior since Java differentiates between primitives and objects.

>It's also expected behavior

That's the whole problem though, it's not.
google.com/search?q=java integer 127&oq=java integer 127

Unless you happen to know that these values are cached you received unexpected results. That's why this is such horrible design. There's no way to know that == compares by value in a certain range and by reference in another without having either specifically looked it up or faced the issue before.

Business idea: get rid of universal ==, !=, equals, toString, and hashCode

>Unless you happen to know that these values are cached you received unexpected results

Wrong. You just have to know how to compare objects properly in Java and understand what == actually does. This is explained in detail in basically every beginner Java book.

Those should all be removed from the top type (Object in Java). Equality and hashing doesn't even make sense for a lot of objects.

I propose typeclasses

I always laugh my ass off at retards who confuse == and equals()

it's such a simple rule to remember
== for primitives and enums
equals() for everything else

if you can't get even this through your skull, look for a new job

I prefer typeclasses but this could be solved with Java interfaces too. Types that want equality should just have to implement an Equals interface.

I disagree. Those methods are the only way to be able to differentiate instances from each other.

No they aren't and the vast majority of classes don't even implement them because they don't make sense for most objects.

>You just have to know how to compare objects properly in Java and understand what == actually does
== in Java compares values on primitive types and references on objects. I do understand what it actually does and the different between it and equalsto. The problem is that in addition to doing that, it also happens to compare values on Integer in a certain number range, which is a quirk contrary to the actual design and purpose of ==.

At this point I assume you're either autistic or trolling because if you can't get the concept through your head that having a quirk like this which is completely contrary to the behavior of == and .equalsto in every other aspect of the language, is generally a bad design choice, then there's no point in continuing our discussion.

>>== for primitives and enums
>>equals() for everything else
you forget
>also == for Integer between an arbitrary number range because language quirks are fun!

>>also == for Integer between an arbitrary number range because language quirks are fun!
just don't touch Objects
even enums should be off-limits, technically

>also == for Integer between an arbitrary number range because language quirks are fun!

Are you legitimately this dumb? This is an impressive level of stupidity.

It's not a language quirk.

werks in c#
int a = 100;
int b = 100;
int c = 1000;
int d = 1000;

Console.WriteLine(a == b); //true
Console.WriteLine(c == d); //true
Console.WriteLine(ReferenceEquals(a, b)); //false
Console.WriteLine(ReferenceEquals(c, d)); //false

Hello world takes up just 178M of RAM

how much RAM the JVM takes up is entirely up to you, retardo

KEK

>also == for Integer between an arbitrary number range because language quirks are fun!

Integer.equals will always give the correct result. == can also give the wrong result if the two Integer objects were loaded by different class loaders.

how is == behaving completely differently in one specific number range on one specific type not a quirk?

It's how the library works, it reuses the same instances for small numbers.

> OOP
Some languages that are actually good: common lisp, ada, haskell, C, python, OCaml

There is no specific number range in Java 7+ and Integer and int are not the same. You should not be comparing Integer objects with ==, you should be using the .equals method since you want to compare the value itself and not the object reference.

Before people start getting triggered, I take it you mean C++, right?

No, plain old C. C++ is the PHP of statically typed languages.

>python

>dynamically typed
>slow
>unicode problems

fuck right off, mate

This thread is already so big, and yet no one has mentioned Java's most annoying fucking problem

>RUNTIME TYPE ERASURE

Writing any even slightly generic parametrized class is nigh-impossible without retarded hacks and/or workarounds

What on earth made Sun do this?

Backwards compatibility.

Erasure is a good thing, anyway.

> What on earth made Sun do this?

Backwards compatibility. Java and C++ are actually used in places that matter so they have to make progress without breaking everything. That often means features can't be implemented in the optimal way. The limitation on Java generics isn't a problem 99% of the time.

> slow
hurr durr my 'hello world' niveau programs need to run on C like speed hurr

Python is way too slow to be acceptable. There are tons of languages that are just as expressive that aren't nearly as slow.

this

>Java and C++ are actually used in places that matter so they have to make progress without breaking everything.
and yet most Java legacy software is just kept on its ancient Java version until it completely dies off

also funny you "know" all this and yet seemingly haven't written anything complex enough to require parametrized generics

You're an idiot.