mirror of
https://github.com/jbranchaud/til
synced 2026-01-15 21:18:02 +00:00
Compare commits
4 Commits
a4959d3791
...
4cd4232a93
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
4cd4232a93 | ||
|
|
ba6492d46e | ||
|
|
3ac3014659 | ||
|
|
295fe153ad |
@@ -10,7 +10,7 @@ pairing with smart people at Hashrocket.
|
||||
|
||||
For a steady stream of TILs, [sign up for my newsletter](https://crafty-builder-6996.ck.page/e169c61186).
|
||||
|
||||
_1449 TILs and counting..._
|
||||
_1450 TILs and counting..._
|
||||
|
||||
---
|
||||
|
||||
@@ -37,6 +37,7 @@ _1449 TILs and counting..._
|
||||
* [HTTP](#http)
|
||||
* [Inngest](#inngest)
|
||||
* [Internet](#internet)
|
||||
* [Java](#java)
|
||||
* [JavaScript](#javascript)
|
||||
* [jq](#jq)
|
||||
* [Kitty](#kitty)
|
||||
@@ -433,6 +434,7 @@ _1449 TILs and counting..._
|
||||
### Java
|
||||
|
||||
- [Install Java On Mac With Brew](java/install-java-on-mac-with-brew.md)
|
||||
- [Run A Hello World Program In Eclipse](java/run-a-hello-world-program-in-eclipse.md)
|
||||
|
||||
### JavaScript
|
||||
|
||||
|
||||
27
java/run-a-hello-world-program-in-eclipse.md
Normal file
27
java/run-a-hello-world-program-in-eclipse.md
Normal file
@@ -0,0 +1,27 @@
|
||||
# Run A Hello World Program In Eclipse
|
||||
|
||||
First, you'll need to create a new Java Project if you don't already have one
|
||||
to work in.
|
||||
|
||||
From there, you can add a new _Class_ to the `src` folder of that project. I'll
|
||||
call mine `Greeting.java` and the only thing it will contain is a `main`
|
||||
method.
|
||||
|
||||
```java
|
||||
public class Greeting {
|
||||
public static void main(String[] args) {
|
||||
String name = args.length > 0 ? args[0] : "World";
|
||||
|
||||
System.out.println("Hello, " + name + "!");
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
This method tries to read a name from the arguments given to the program at
|
||||
time of execution. If one wasn't provided the ternary falls back to `"World"`
|
||||
as the default name. It then prints the greeting to stdout.
|
||||
|
||||
To run this program, we can either select _Run_ from the _Run_ menu (which will
|
||||
result in `Hello, World!`) or we can select _Run Configurations..._ from the
|
||||
same menu and add a custom name to _Program Arguments_ under the _Arguments_
|
||||
tab.
|
||||
@@ -5,6 +5,8 @@ an array-like object with all of the arguments to the function. Even if not
|
||||
all of the arguments are referenced in the function signature, they can
|
||||
still be accessed via the `arguments` object.
|
||||
|
||||
> For ES6+ compatibility, the `spread` operator used via [rest parameters](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Functions/rest_parameters) is preferred over the `arugments` object when accessing an abritrary number of function arguments.
|
||||
|
||||
```javascript
|
||||
function argTest(one) {
|
||||
console.log(one);
|
||||
|
||||
Reference in New Issue
Block a user