The Meaning of Life, the Universe, and Everything.
Join Date:
2/11/2017
Posts:
662
Member Details
Before asking this question, I want to just clarify the differences between java and javascript as far as I know.
Java
every variable must be clarified by what type of variable it is (Integer, String, etc.)
Methods, Arrays, etc. are very picky on what type of object they will take as parameters.
Variables must be categorized using the words public, static, private, final, etc.
A variable cannot be accessed by another class unless it is static.
Static variables cannot be manipulated by other classes
Functions can return values, but the value it returns has to be a certain type of variable (the type you declared it as) For example:
public boolean test() {
return 1;
}
would not be possible. It would have to be:
public int test() {
return 1;
}
That's all that I know for sure, but there is probably a lot more.
Javascript
Variables do not have to be specified by type. In fact, one variable can transfer from an integer to a string with ease.
Since variables do not have specific types, functions, arrays, and other things can take any parameter at any time without causing an error (it might crash upon running, but it doesn't cause an error immediately.)
Variables do not have to be categorized at all and they can still be accessed and edited from anywhere in your programs.
Functions can return any value at any time. since variables do not have to be specified, you could have a function return a string or an integer within the same group of code. For example:
var test = function() {
if(isTest) {
return 1;
}
else {
return "could not perform test";
}
}
As far as I know, that is impossible in Java.
Javascript uses files instead of classes, interfaces, etc., which makes it much simpler to use.
That's all that I know for sure, but there is probably a lot more.
So, which one do you like best? Open the spoiler to see my preference
Pros
I like Javascript better due to simplicity. I don't have to categorize my variables, I don't have to set a specific type for my variable, and I don't have to worry about value interferences.
For example, I was doing some minecraft modding, and I wanted to put blocks into an array for a method to use. The method took the object type "Block", so I made the array type "Block". But when I added the blocks into the array, an error came that said: "Cannot convert from Block to Blocks". I then changed the array type "Blocks", and another error said: "Cannot convert from Blocks to Block". Changing the array type to "Object" fixed the array, but when trying to put it into a method, it didn't work because the method required an object type "Block" instead of "Object". So I had to work around that typing about 3 times the amount of code that was needed, all because of that array.
Cons
Due to this simplicity, though, your code can get disorganized faster, and it doesn't catch as many errors.
For example, I had a simple program that would subtract the player's health by a projectile's damage, but the player's health kept coming out as "NaN". It turns out that I had misspelled projectileDamage inside of the projectile object, so the projectile damage was returning "Undefined" because that variable technically didn't exist. And since you cannot subtract a number by "undefined", the player's health got set to "NaN", and the player immediately died. Java would have caught an error like that.
To download the other ones you need to make a folder in the versions folder for minecraft and put the client and JSON file for the versions in there. They all need to be named the same aside from file extensions. Once you do that, you will be able to choose that version when making a new profile with the minecraft launcher.
Just wanted to say that Java and Javascript are about as similair as car and carpet. Java is an object oriented programming language most relatably used for android apps and minecraft plugins. Javascript on the other hand is (mostly) a scripting language primarily used to bring web pages to life. Just thought I'd chime in.
--
As far as learning a language, I would reccomend getting an understanding of the basics with Python and the Turtle library. It was made by MIT students as a visual learning tool. It is how I learned the basics and really helped. Then, I would pick up a book called "Head First Java (2nd Edition)" and watch some youtube videos to begin coding spigot plugins.
Just wanted to say that Java and Javascript are about as similair as car and carpet.
They look pretty similar to me. They have the same types of statements (if, then, while, and for), the same types of variables (strings, integers, booleans, and decimals), and the syntax is pretty much the same (semicolons, parenthesis, +=, -=, *=, etc.).
To download the other ones you need to make a folder in the versions folder for minecraft and put the client and JSON file for the versions in there. They all need to be named the same aside from file extensions. Once you do that, you will be able to choose that version when making a new profile with the minecraft launcher.
Before asking this question, I want to just clarify the differences between java and javascript as far as I know.
Java
would not be possible. It would have to be:
That's all that I know for sure, but there is probably a lot more.
Javascript
As far as I know, that is impossible in Java.
That's all that I know for sure, but there is probably a lot more.
So, which one do you like best? Open the spoiler to see my preference
Pros
I like Javascript better due to simplicity. I don't have to categorize my variables, I don't have to set a specific type for my variable, and I don't have to worry about value interferences.
For example, I was doing some minecraft modding, and I wanted to put blocks into an array for a method to use. The method took the object type "Block", so I made the array type "Block". But when I added the blocks into the array, an error came that said: "Cannot convert from Block to Blocks". I then changed the array type "Blocks", and another error said: "Cannot convert from Blocks to Block". Changing the array type to "Object" fixed the array, but when trying to put it into a method, it didn't work because the method required an object type "Block" instead of "Object". So I had to work around that typing about 3 times the amount of code that was needed, all because of that array.
Cons
Due to this simplicity, though, your code can get disorganized faster, and it doesn't catch as many errors.
For example, I had a simple program that would subtract the player's health by a projectile's damage, but the player's health kept coming out as "NaN". It turns out that I had misspelled projectileDamage inside of the projectile object, so the projectile damage was returning "Undefined" because that variable technically didn't exist. And since you cannot subtract a number by "undefined", the player's health got set to "NaN", and the player immediately died. Java would have caught an error like that.
Remember those versions that minecraft pranked us with? Specifically:
Those are still downloadable! Watch this video for 2.0:
https://www.youtube.com/watch?v=PQdu9LKAdIU
To download the other ones you need to make a folder in the versions folder for minecraft and put the client and JSON file for the versions in there. They all need to be named the same aside from file extensions. Once you do that, you will be able to choose that version when making a new profile with the minecraft launcher.
15w14a is on this link:
http://minecraft.gamepedia.com/15w14a
1.RV-Pre1 is here:
http://minecraft.gamepedia.com/1.RV-Pre1
Minecraft 3D is here:
https://minecraft.gamepedia.com/Java_Edition_3D_Shareware_v1.34
Hi man,
Just wanted to say that Java and Javascript are about as similair as car and carpet. Java is an object oriented programming language most relatably used for android apps and minecraft plugins. Javascript on the other hand is (mostly) a scripting language primarily used to bring web pages to life. Just thought I'd chime in.
--
As far as learning a language, I would reccomend getting an understanding of the basics with Python and the Turtle library. It was made by MIT students as a visual learning tool. It is how I learned the basics and really helped. Then, I would pick up a book called "Head First Java (2nd Edition)" and watch some youtube videos to begin coding spigot plugins.
They look pretty similar to me. They have the same types of statements (if, then, while, and for), the same types of variables (strings, integers, booleans, and decimals), and the syntax is pretty much the same (semicolons, parenthesis, +=, -=, *=, etc.).
Javascript is pretty object oriented too. It has the same types of objects and creating objects uses the same method.
It may be designed for web pages, but I have found that it could be used for about anything much easier than other programming languages.
Remember those versions that minecraft pranked us with? Specifically:
Those are still downloadable! Watch this video for 2.0:
https://www.youtube.com/watch?v=PQdu9LKAdIU
To download the other ones you need to make a folder in the versions folder for minecraft and put the client and JSON file for the versions in there. They all need to be named the same aside from file extensions. Once you do that, you will be able to choose that version when making a new profile with the minecraft launcher.
15w14a is on this link:
http://minecraft.gamepedia.com/15w14a
1.RV-Pre1 is here:
http://minecraft.gamepedia.com/1.RV-Pre1
Minecraft 3D is here:
https://minecraft.gamepedia.com/Java_Edition_3D_Shareware_v1.34