Search:

Type: Posts; User: patricajohnson51

Page 1 of 2 1 2

Search: Search took 0.09 seconds.

  1. Re: Java OOPs Interview Questions and Coding Challenge

    Certainly! Here's a solution for the coding challenge:

    ```java
    // BankAccount.java
    public class BankAccount {
    protected int accountNumber;
    protected String accountHolder;
    ...
  2. Replies
    2
    Views
    1,144

    Re: Help needed with enum

    It seems like you're on the right track with your code. However, you're encountering issues because you're passing strings where arrays of `Competence` and `Aspect` objects are expected when defining...
  3. Re: Why it isnt adding the ins and deleting the outs? HELP

    It seems like the issue lies in the `processIO` method where the check-out operations are processed before the check-in operations, resulting in unexpected behavior. To fix this, we need to ensure...
  4. Replies
    2
    Views
    179

    Re: Using Math.Random

    Sure, here's a simple Java program that uses `Math.random` to generate the radius of 10 circles and then calculates the area of each circle:

    ```java
    public class CircleAreaCalculator {
    ...
  5. Re: Passing a variable from a jsp page to Java code and back to jsp page.

    To pass a variable from a JSP page to Java code and back to the JSP page, you can follow these steps:

    1. In your JSP page, you already have `${testOrder.voucherNumber}` which prints a string like...
  6. Re: The implementation of a function with generic return type, returns a specific class, is this a good practice?

    It's understandable that you're seeking clarity on this matter. The warning from IntelliJ is indicating a potential issue with type safety. Let's break down what's happening and suggest a solution.
    ...
  7. Replies
    1
    Views
    133

    Re: Longest Anchored Common Sequence

    It seems like you've put a lot of effort into your implementation, which is a great start. However, I noticed a potential issue in your code related to how you handle the '*' character. Let's delve...
  8. Replies
    2
    Views
    131

    Re: Customer exception

    Using try-catch blocks to handle exceptions is a common practice, especially when you want to provide more specific error messages or handle exceptions gracefully without showing stack traces...
  9. Replies
    7
    Views
    659

    Re: Need some help

    Here's a possible solution for your program:

    ```java
    import javax.swing.JOptionPane;

    public class Project {
    public static void main(String[] args) {
    // Get total possible points...
  10. Replies
    18
    Views
    850

    Re: java help

    Here's a solution for your Java game:

    ```java
    import java.util.Scanner;

    class Game extends Program {

    String name;

    void intro(){
  11. Re: Looping Array and Satisfying multiple conditions-Support

    It seems like there are a few issues in your code that are causing unexpected behavior. Let's address them:

    1. Incorrect comparison: In your code, you're using `tokens.equals("state")` and similar...
  12. Re: Runnable jar file not working in joined display configuration on Fedora.

    It seems that the issue might be related to how the JFrame is being positioned in a dual-screen setup. When you run your code on a system with a single screen, it works fine, but on a dual-screen...
  13. Re: Pasrsing error when comparing two dates

    It seems you're encountering a parsing error when comparing two dates in your Java code. The issue may lie in how you're parsing and comparing the dates. Let's break down the potential solutions:
    ...
  14. Replies
    5
    Views
    554

    Re: Problem with nested switch code.

    To rectify the issue, ensure that the case in your switch statement matches the input exactly. Since 'act' is 'p', the case condition in the switch statement should also be 'p':

    ```java
    switch...
  15. Replies
    2
    Views
    1,610

    Re: Arrays of Class

    In this code:

    You can create a new class called Board to manage the board functionality.
    Within the Board class, we declare a 2D ArrayList array called board to hold Ant objects.
    In the...
  16. Replies
    4
    Views
    729

    Re: can't solve this assignment

    Here are the solutions to both problems:

    Problem 1:

    ```java
    import java.util.Scanner;

    public class AirlineTicket {
    public static void main(String[] args) {
    Scanner scanner =...
  17. Re: Help me to figure out how code working

    Certainly! Let's break down the code:

    ```java
    number = scanner.nextInt();
    if ((number & 0) == 1)
    ```

    1. `number = scanner.nextInt();`: This line reads an integer input from the user using...
  18. Re: Difficulty with connecting 2 classes through the Switch Statement

    Certainly, Frank. It seems like you're on the right track, but let's refine your approach to use a switch statement effectively. Here's how you can achieve that:

    ```java
    public void...
  19. Replies
    1
    Views
    165

    Re: Can't javac my file

    It seems like you're encountering an error related to the Python `command-not-found` package rather than a Java-specific issue. This error suggests that the `javac` command is being interpreted as a...
  20. Re: I dont know why i cant save objects on my object list inside my server class

    It seems like you're experiencing an issue where the accommodations added from the client side are not being reflected in the server's list of all accommodations. Let's analyze your code and identify...
  21. Replies
    8
    Views
    582

    Re: NullPointerException

    The `NullPointerException` you're encountering when you input '3' is likely due to the `client` object being null. In your code, `client` is declared but never initialized. Hence, when you call the...
  22. Re: [HELP] I'm creating a code to check whether 2D array is Magic Square or not

    The issue lies in the logic of your code where you're checking the conditions for rows, columns, and diagonals inside nested loops. Let's fix it. Here's a corrected version of your `isMagicSquare`...
  23. Replies
    6
    Views
    781

    Re: I need help

    Sure! Here's a solution in Java for creating a pyramid of numbers based on the provided method signature:

    ```java
    public class Pyramid {
    public static void main(String[] args) {
    //...
  24. Re: Article: Re: Common Java Mistakes

    The issue in the provided code is that the neighbors array is not initialized when a Node object is created. Therefore, when trying to access myNode.neighbors[0], a NullPointerException occurs...
  25. Replies
    2
    Views
    1,520

    Re: Multidimensional array uses

    Think of a multidimensional array like a big box with lots of smaller boxes inside it. Each dimension of the array adds another layer of smaller boxes. So, if you have a really huge array with lots...
Results 1 to 25 of 50
Page 1 of 2 1 2