Category: Java

  • Implementation of a Singly Linked List with Reversal and Cyc…

    Please provide a complete Java implementation of a Singly Linked List that includes the following functionality:

    1. Basic Operations: Methods to insertAtEnd, deleteByKey, and displayList.
    2. Algorithm 1 (Reversal): An efficient iterative method to reverse the linked list in place ( time complexity, space).
    3. Algorithm 2 (Cycle Detection): Implement Floyds Cycle-Finding Algorithm (Hare and Tortoise) to detect if the list contains a loop.

    Requirements:

    • Language: Java (JDK 17 or higher).
    • Structure: Use a separate Node class and a LinkedList class.
    • Documentation: Please include comments explaining the logic for the reversal and cycle detection parts.
    • Testing: Provide a main method that demonstrates these features working correctly.”
  • Java Question

    Inheritance in Java is when a class (child) acquires the properties and methods of another class (parent), allowing code reuse.

    Polymorphism is the ability of a method or object to take many forms, such as method overriding (same method, different behavior) or method overloading (same name, different parameters).

  • Java Question

    q1 – Please Open android studio and do the following: (you need to take screenshots of every steps that also authenticate your identity)

    1. Create a new Android project (use your name).

    2. Before you start, make sure to add constraint layout and make sure the Layout width and layout height is match parent. Also, make sure the Objects are work perfectly with each device.

    3. Add two buttons. Add text view includes this statement Welcome to Fun app .

    4. Assign unique IDs to each button and change the color for text view to red.

    5. In MainActivity.java, make each button display:

    A Toast message to the user (message should show your name and University ID).

    A Log message in Logcat (message should show your name and University ID).Q

    Please Open android studio and do the following: (you need to take screenshots of every steps that also authenticate your identity)

    ——————————————————————————————————-

    q2 – Explain how Java and Android work together to build and run Android applications and what is the difference between activity_main.xml and MainActivity.java?

    In your answer, discuss:

    The role of Java in Android development

    The compilation process (Java code Bytecode Machine code)

    The role of Android Runtime (ART)

    What an APK file contains

    Difference between .xml and .java and how they work together.

    What is res folder and java folder?

    Provide clear explanations of each stage of the execution process, your answer length should be reasonable, any very long answer will deduct your grade.

    6. Run the app using the Android Emulator.

    7. Write the Java code inside the onCreate() method here

    6. Run the app using the Android Emulator.

    7. Write the Java code inside the onCreate() method here:

    ———————————————————————————————–

    q3 – There are many files and folders when creating a new project (such as manifests, java, res, and Gradle Scripts).

    Note: Someone delete one of these files and folder.

    What challenges would developers face?

    How would the absence of the AndroidManifest.xml file affect an app?

    Why is calling super.onCreate() important in an Activity?

    How does the emulator improve development efficiency compared to testing directly on a physical device?

    In your opinion, which folder (manifests, java, res) is most important and why?

    Try to support your answer with logical reasoning and answer for each question. your answer length should be reasonable, any very long answer will deduct your grade.

  • Write the java programme additional by users .

    import java.util.Scanner;

    class R

    {

    public static void main(String args[])

    {

    Scanner sc=new Scammer(System.in);

    System.out.println(“Enter the first number”);

    int x=sc.nextInt();

    System.out.println(“Enter the second number”);

    int y=sc.nextInt();

    int sum=0;

    System.out.println(“sum=”+(x+y));

    }

    }

  • java computer programming

    Computer programming language

  • Java Question

    • Understanding of
    • Understanding of
    • Ability to explain object-oriented principles in
    • Ability to apply theory with code examples
  • Java Question

    Java Programming Quiz (Beginner Level)

    1. What is Java?

    A) A database

    B) A programming language

    C) An operating system

    D) A web browser

    Correct Answer: B) A programming language

    2. Which company originally developed Java?

    A) Microsoft

    B) Sun Microsystems

    C) Google

    D) Apple

    Correct Answer: B) Sun Microsystems

    3. Which method is the entry point of a Java program?

    A) start()

    B) run()

    C) main()

    D) execute()

    Correct Answer: C) main()

    4. Which keyword is used to define a class in Java?

    A) function

    B) class

    C) define

    D) object

    Correct Answer: B) class

    5. Which symbol is used to end a statement in Java?

    A) .

    B) ,

    C) ;

    D) :

    Correct Answer: C) ;

    6. Which data type is used to store numbers with decimals?

    A) int

    B) float

    C) char

    D) boolean

    Correct Answer: B) float

    7. Which keyword is used to create an object in Java?

    A) create

    B) make

    C) new

    D) object

    Correct Answer: C) new

    8. Which loop is used when the number of iterations is known?

    A) while

    B) do-while

    C) for

    D) if

    Correct Answer: C) for

    9. Which operator is used for comparison in Java?

    A) =

    B) ==

    C) :=

    D) =>

    Correct Answer: B) ==

    10. Java is a ______ programming language.

    A) Platform-dependent

    B) Platform-independent

    C) Machine language

    D) Assembly language

  • IT-401: Business Computer Languages

    Instructions

    • Use the assignment template provided.
    • Fill in your information on the cover page.
    • Clearly mention the question number before each answer.
    • Make sure the work is clear and well-presented.
    • Show all steps/work if required in the questions.
    • All answers must be typed using Times New Roman, size 12, double-spaced.
    • Do not convert text into images unless the question asks for it.
    • Follow the required word count for each question.
    • Prepare two files: Word (.docx) and PDF.
    • Please do not use AI in order to avoid grade reductions
    • I uploaded two files: the first one is the book, and the second one is the assignment
  • Java homework

    Hello,

    I need help running a Java program for my assignment.

    The program must be written in Java using Swing and should do the following:

    Create a window using JFrame with a drawing panel.

    When the user clicks somewhere on the panel, the program should open an input dialog asking for the radius.

    After the user enters the radius, the program should draw a circle centered at the mouse click location.

    The program should allow drawing multiple circles in different locations, not just one.

    Since I am using ChromeOS and cannot run Java Swing GUI programs easily, could you please run the program and send me:

    1. the full working Java code
    2. screenshots showing the program running
    3. a final screenshot with at least 5 circles drawn on the panel

    Thank you.

  • ATM Machine code using Exception handling

    A simple code to understand Exception Handling