본문 바로가기
728x90

Java Examples6

[Java Examples] Rectangle.java를 활용해서 집 크기 구하기 예제코드 및 설명 Rectangle.java를 활용해서 집 크기 구하기 예제코드 및 설명 포스트 난이도: HOO_Junior # Example Code public class Immutable_Rectangle { //Fields of the class rectangle final private double length; final private double width; //Getter methods(Accessor methods) public double getLength() { return length; } public double getWidth() { return width; } public double getArea() { return width * length; } //Constructor public Immu.. 2024. 3. 4.
[Java Examples] Array Lists, 어레이 리스트 예제코드 및 설명 Array Lists, 어레이 리스트 예제코드 및 설명 포스트 난이도: HOO_Junior # Example Code import java.util.ArrayList; public class ArrayList_Practice { public static void main(String[] args) { ArrayList nameList = new ArrayList(); nameList.add("Amy"); nameList.add("Ryan"); nameList.add("Jin"); System.out.println("The array has " + nameList.size() + " names."); for(String s : nameList) System.out.println(s); System.out... 2024. 2. 21.
[Java Examples] 다중 if문을 활용한 Troubleshooting 문제 해결 예제코드 및 설명 다중 if문을 활용한 Troubleshooting 문제 해결 예제코드 및 설명 포스트 난이도: HOO_Junior # Example Code import java.util.Scanner; /** * This class provides a step-by-step troubleshooting guide for fixing Wi-Fi connection issues. */ public class WifiTroubleshooter { // Scanner for user input private static final Scanner scanner = new Scanner(System.in); /** * The main method starts the troubleshooting process. * @param a.. 2024. 2. 14.
[Java Examples] Method Overloading in Java Method Overloading in Java 포스트 난이도: HOO_Intern # Example Code public class ExMethodOverloading { // Overloaded method for adding two integers public int add(int num1, int num2) { return num1 + num2; } // Overloaded method for adding three integers public int add(int num1, int num2, int num3) { return num1 + num2 + num3; } // Overloaded method for adding two doubles public double add(double num1,.. 2024. 2. 12.
[Java Examples] 상자 용량, 면적 구하는 예제 및 설명 상자 용량, 면적 구하는 예제 및 설명 포스트 난이도: HOO_Intern # Example Code public class Rectangle { private double length; private double width; // Constructor public Rectangle(double len, double w) { length = len; width = w; } // Setter for length public void setLength(double len) { length = len; } // Setter for width public void setWidth(double w) { width = w; } // Getter for length public double getLength() { .. 2024. 2. 7.
[Java Examples] 상자, 직사각형의 크기를 구하는 예제 및 설명 상자, 직사각형의 크기를 구하는 예제 및 설명 포스트 난이도: HOO_Intern # Example Code //Example1 public class Rectangle { private double length; private double width; public void setLength(double l) { length = l; } public double getLength() { return length; } public void setWidth(double w) { width = w; } public double getWidth() { return width; } public static void main(String[] args) { Rectangle rect = new Rectangle();.. 2024. 2. 5.
728x90