<p>Here is how you can create a class called "Employee" with a non-default constructor (a constructor that takes parameters) and a getter and setter</p>
<pre><codeclass="language-java">public class Employee {
// Our private variables
private String name;
private double salary;
// Non-default constructor
public Employee(String name, double salary) {
this.name = name;
this.salarly = salary;
}
// This is a getter
public string getName() {
return name;
}
public double setSalarly(double salary) {
this.salary = salary;
}
}</code></pre>
<h2>For Loops + Arrays</h2>
<p>For loops are constructed in the following way</p>
<p><code>for (initialization; condition to stop; increment to get closer to condition to stop)</code></p>
<pre><codeclass="language-java">//Assume an array with variable name array is declared before
for (int i = 0; i < array.length; i++) {
// This code will loop through every entry in the array
}</code></pre>
<p>Note that you don't always have to start from zero, you can start anywhere from the array.</p>
<h2>For Loops + Arrays + Methods</h2>
<p>This is an example of how you can take in an array in a method</p>
for (int i = 0; i < array.length; i++) { // Iterate through the entire array
// If you find an odd number, return false
if (array[i] % 2 == 1) {
return false;
}
}
// If you didn't find any odd numbers, return true
return true;
}</code></pre>
<h2>File I/O</h2>
<p>Let's say that you have the following file</p>
<pre><code>4
chicken
3
salad</code></pre>
<p>And you want to make it so that you take the number, and print the word after it a certain number of times. For this example we would want to see the following</p>