Why is there so much data doubled (seemingly redundant coding) in Java?


Why is there so much data written twice, or sometimes trice in Java?

I don't have a lot of coding experience. Only HTML or PLC, and I usually would get rid of double data.

In the line below, a new 'Coffee' object was created, called 'myOrder'.
Why do I need to redefine Coffee at the end (with parameters if it is possible), even if there are no parameters to fill out?

public static void main(String[] args) {

Coffee myOrder = new Coffee();




That's the syntax for creating an object (or instantiating a class) in Java.
LHS Coffee myOrder means myOrder is derived from the Coffee class.
RHS new Coffee(); means the LHS myOrder has been instantiated.
When you think about it, yes, maybe it could have been done such as

new myOrder Coffee();

When you're knowledgeable enough, you can grab the source code and recompile the source with your own mods. Then fork the compiler on GitHub and make a name for yourself.


Give me about a 100 years or so :wink:

When I was processing webpages, a lot of the webpages often had redundant code in them.
My main job was getting rid of classes, and code that made no sense being there (classes that would change the properties of letters of all subsections of the HTML site), and reduce web size to a fraction of the original size, with minimal compromise on it's function or layout.

HTML is very easy compared to Java.
It is also very straight forward, and sites run with very little double info in them (especially HTML0 code used for creating ebooks).

From HTML and Ebooks, to Java!
Cheers! :beers:


HTML is not a computer language. It's a script. You're comparing chalk and cheese. Java is very easy once you get familiar with it. Don't give up. It's like learning a human language.
The better you are at it, the better you can express yourself in that language and get things done.
All computer languages have a basic flow or conditionals. Also, declarations of types. Those things never change. You can talk about Python and how easy it is until you're blue in the face. Python derived from some other language. In the end, every computer language derived from machine code.
I learnt machine code before I learnt C or Basic, so I have to shake my head at some of the arguments put forward for making programming languages easier. Have we as a species become so lazy ? LOL Then again would I buy a forge and make my own knives and forks. I would, given the chance and space and time and money.
You won't appreciate how complex and elegant some of the programming languages are until you program in machine code. The complexity and smoothness of optimizing compilers is something I find amazing still.

I was curious about the actual definition of HTML. It's been years since I've used it. So the update is Markup language not scripting language


Machine code sounds complex to me.
Almost as complex as creating a program from binary code... lol.


Don't give up, you'll eventually understand the syntax of java...i'm coming from C# so it's a bit more easier for me to understand but trust me learning java will be very rewarding..something i did learning c# an now i'm also doing learning java is using a book as well..every time i don't understand something i just go through the book for a more deep explanation...doing this along with the code academy activities is very rewarding!