Practice Exam

This commit is contained in:
2022-11-02 09:15:54 -05:00
parent d32ce7930a
commit c879dde19e
27 changed files with 4358 additions and 0 deletions

View File

@@ -0,0 +1,21 @@
/*
* Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license
* Click nbfs://nbhost/SystemFileSystem/Templates/Classes/Main.java to edit this template
*/
package practiceexamchapter6_calebfontenot;
/**
*
* @author caleb
*/
public class PracticeExamChapter6_CalebFontenot {
/**
* @param args the command line arguments
*/
public static void main(String[] args)
{
}
}

View File

@@ -0,0 +1,24 @@
/*
* Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license
* Click nbfs://nbhost/SystemFileSystem/Templates/Classes/Class.java to edit this template
*/
package practiceexamchapter6_calebfontenot.methods_test;
/**
*
* @author caleb
*/
public class Increment {
public static void main(String[] args) {
int x = 1;
System.out.println("Before the call, x is " + x);
increment(x);
System.out.println("After the call, x is " + x);
}
public static void increment(int n) {
n++;
System.out.println("n inside the method is " + n);
}
}

View File

@@ -0,0 +1,44 @@
/*
* Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license
* Click nbfs://nbhost/SystemFileSystem/Templates/Classes/Class.java to edit this template
*/
package practiceexamchapter6_calebfontenot.methods_test;
/**
*
* @author caleb
*/
public class Methods {
public static int maxOf3(int x, int y, int z)
{
if (x > y) {
if (x > z) {
return x;
} else {
return z;
}
} else if (y > z) {
return y;
} else {
return z;
}
// return -1;
}
public static void printMessage(String message, int howManyTimes) {
for (int i = 0; i < howManyTimes; ++i) {
System.out.println(message);
}
}
public static void main(String[] args)
{
//printMessage("the good, the bad, and the ugly", 100000);
System.out.println(maxOf3(3, 2, 1));
System.out.println(maxOf3(1, 2, 3));
System.out.println(maxOf3(1, 1, 1));
System.out.println(Methods.maxOf3(1, 2, 3));
}
}