yego.me
💡 Stop wasting time. Read Youtube instead of watch. Download Chrome Extension

Java Lesson 1 | Hello World


3m read
·Nov 3, 2024

This bath has 101. I'm a special guest. My name is Jake, and this will be the first of my Java tutorial.

So, the first thing we need to do, if you don't already have Eclipse, is download that. You get that from eclipse.org and then downloads. The one I'm going to be using is this one at the bottom: Eclipse Classic. Of course, I'm not gonna be downloading that because I already have it, but if you don't, download that.

So first, just going to open up Eclipse. I'm gonna make it a HelloWorld application in this one, so just letting you know. Um, so the first thing I actually need to do is File, New. We're gonna be creating a new Java project.

So this is our project, and I'll name the projects "the projects." Then, window, show view, Project Explorer, so we can see all the projects. Now, we can't just start coding in there because we don't have a class yet; it's actually where to write the code in.

So, you click File, New, Class. I'll name that class "Capital" and "MathHeads." Now I'll just double click this to make it bigger.

So now what we have is a class, it's "public class SmackHeads." In order to actually make some code to execute, we need to make a main method. What the main method is, it's what Java is gonna be executing the code from. But first, a method—what that is—is it is a list of instructions essentially.

So, like, if I had my own method for making soup, like the method for making soup would be like: cut vegetables, sauté vegetables, boil stock, something like that. So the method is the list of instructions that we're going to be doing.

To make the main method, you have to write all this. You don't really have to understand much of it right now because it's just not important, but you write "public static void main." The "public static void" is what's important because that means it's the main method. Then, capital S with "String args" brackets with nothing in them.

This you do need to understand. Now, the curly braces—whatever is in here is the body of the method, just as whatever is within these two is what's in the class, which would be methods.

To make the HelloWorld, it basically prints out "Hello World" to the console. So to do that, you type "System" with a capital S, dot "out," dot "print." Then, in parentheses, you write what you want to print, which we're gonna put in quotes because if you're just printing text, you have to put it in quotes.

So in the close, I'm gonna put "Hello space World," and you have to end the line with a semicolon. So "System.out.print" and "Hello World" and you click this little green button to compile it, and it prints "Hello World" to the console.

Now, there's also "System.out.println," which prints like a newline. So I'll show you the difference between the two. I'm going to make another print statement, and I don't know why I didn't just copy and paste this. Whatever, hi.

So now if I compile this, you see they're right next to each other. Of course, I could just, you know, put a space right here. But if I want them to each be on different lines, I would have to do "System.out.println," and that prints it on a whole nother line.

So if you wanted it to be printed on a whole nother line, use "System.out.println." If you just wanted to print it on the same line, then use "print."

So that is Hello World, and then we'll see you in my next tutorial.

More Articles

View All
Top Markets To Look Out For In 2022 | Kevin O'Leary's 2022 Resolutions
You know, it’s that time of the year! Brand new year, lots of hope and excitement, but always the time of year to reflect on what’s just passed and also set up some resolutions. What’s wrong with that? Now for me, let me tell you what I’m doing. Number o…
The Controversial Physics of Curling - COLD HARD SCIENCE - Smarter Every Day 111
Hey, it’s me Destin, welcome back to Smarter Every Day. So in the last episode, I explained that it’s not always the most athletic team that wins in sport; sometimes it involves the physical manipulation of objects, so sometimes it’s the most intelligent …
_-substitution: definite integrals | AP Calculus AB | Khan Academy
What we’re going to do in this video is get some practice applying u-substitution to definite integrals. So let’s say we have the integral. So we’re going to go from x equals 1 to x equals 2, and the integral is (2x \times (x^2 + 1)^3 \, dx). So, I alrea…
A Beginners Guide to Stock Valuation (Intrinsic Value and Margin of Safety)
[Music] So when it comes to stock market investing, there are a lot of things that we as investors need to remember. For example, we need to understand the business. We need to make sure the business has a long-term durable competitive advantage. We need…
Gordon Ramsay Learns to Spearfish | Gordon Ramsay: Uncharted
Spear fishing in Hawaii, I’m like a fish out of water. Thank God I’ve got free diving champ Kimi for a guide. She makes it look so easy. [Music] Damn, she’s good. [Music] Despite my fetching camouflage, I can’t hit a thing. Don’t get frustrated! Oh man, …
Hard Pill to Swallow | Badlands, Texas
Something was taken from Tringa that can’t be given back. I don’t think in my lifetime Tring was ever hit this hard. This was an atrocity; that’s a hell of a thing for a community to try and swallow. But they ain’t going to forget. Tony Flint just walked…