CsitLabs
  • CSIT Labs
  • 1st Semester
    • Digital Logics
      • Lab 1
      • Lab 2
      • Lab 3
      • Lab 4
      • Lab 5
      • Lab6
    • IIT
    • Physics Lab Report Formet
  • 2nd Semester
    • Algorithms used in Discrete Structure class
    • Microprocessor
      • 8085 Microprocessor
        • Arithmetic and Logical Instruction Set
        • Branching Instruction Set
        • Data Transfer and Instruction Set
        • Multiply, Divide and Memory Block Operations
        • Rotate Instruction Set
        • Subroutine, Stack and BCD Conversion](Subroutine_Stack_BCD_Conversion
      • 8086 Microprocessor
        • Basic Arithmetic
        • Practice Programs for 8086 Microprocessor
        • String Processing
    • Object Oriented Programming using C++
      • File Access Pointers
      • Standard Exceptions in C++
    • Statistics-I
  • 3rd Semester
    • Computer Architecture
      • Practical labs
    • Computer Graphics
      • Practial
      • Simulation of Two Dimensional Transformation
      • Scan Conversion Algorithm
    • Data Structures and Algorithms
      • Array methods (Introduction)
      • Stack
      • Queue
      • Recursion
      • Linked List
      • Sorting Algorithms
      • Searching and Hashing Algorithms
      • Trees and Graphs
      • Lab practice
    • Numerical Method Labs
      • Lab practice
    • Statistics-II Labs
      • Confidence interval of mean assuming normal distribution
      • One Sample T test
      • Two Sample T test
      • Regression Analysis
      • Two Sample T test
      • Design_of_Experiment
        • CRD (Completely Randomized Design)
        • RBD (Randomized Block Design)
        • RBD (Randomized Block Design)
      • Non-parametric_test
        • Binomial Test
        • Cochran Q test
        • Kolmogorov-Smirnov one sample test
        • Run test
        • Friedman-F_test
          • Friedman F test
          • Friedman F test
        • Kruskal-Wallis-H_test
          • Kruskal Wallis H test
          • Kruskal Wallis H test
        • Mann-Whitney-U_test
          • Mann Whitney U test
          • Mann Whitney U test
        • Median_test
          • Median Test
          • Median Test
        • Wilcoxon-Matched-pair_signed_rank_test
          • Wilcoxon Matched pair signed rank test
          • Wilcoxon Matched pair signed rank test
  • 4th Semester
    • Artificial Intelligence
    • Computer Networks
      • Networking commands in CMD
    • DBMS Lab
    • Operating System
      • Linux Commands
    • Theory of Computation
      • Lab 1 (DFA)
      • Lab 2 (NFA)
  • 5th Semester
    • Cryptography
    • Design and Analysis of algorithms
    • Multimedia
      • Animation Creation with Blender
      • FL Studio - Simple Effect Creation
      • Macromedia FreeHand - Logo Creation
      • Audio Mixing
      • Adobe Photoshop - ID Card Creation
      • Video Editing with Adobe Premiere Pro
    • Simulation & Modeling
      • Lab 1: Random Number Generation
    • System Analysis and Design
    • Web Technology
      • Lab Assignment – I (HTML)
      • Lab Assignment – II (CSS)
      • Lab Assignment – III (JavaScript and XML)
      • Lab Assignment – IV (PHP)
      • Web Technology
        • php
          • Database connection using PHP and MySQL
          • Login form
          • Login form
  • 6th Semester
    • Compiler Design and Construction
    • NET Centric Computing
      • Class Codes
        • Authentication and Authorization in ASP.NET
        • C# Basics
      • Lab Codes
        • Practical 1
        • Practical 2
          • Number Operations Web App
          • User Registration Form
          • User Registration Console App
        • Practical 3
          • Authentication and Authorization (Claims, Roles and Policies)
          • Client side state management in ASP.NET
          • Entity Framework Core
          • Form Validation
            • React form validation
          • HTML Tag Helpers
          • MVC demonstration
          • Razor Syntax
          • Server Side State Management in ASP.NET
      • Self Projects
        • Do while programs
        • Role playing game battle challenge
        • Project overview
        • Authentication
          • wwwroot
            • lib
              • jquery-validation
                • The MIT License (MIT)
  • 7th Semester
    • Advanced Java Programming
      • Class Codes
        • Unit1-6&8
          • javafx-sdk-21.0.1
            • legal
              • javafx.graphics
                • Independent JPEG Group (IJG) JPEG v9e
                • Mesa 3-D Graphics Library v21.0.3
              • javafx.media
                • Microsoft DirectShow Samples v156905
                • GNU Glib v2.72.0
                • GStreamer v1.20.1
                • LibFFI v3.4.4
              • javafx.web
                • IBM International Components for Unicode (ICU4C) v73.1
                • xmlsoft.org: libxml2 v2.10.4
                • xmlsoft.org: libxslt v1.1.35
                • WebKit Open Source Project: WebKit v616.1
          • src
            • main
              • java
                • Unit 1: Programming in Java
                  • 2. Concepts and Topics
                • Unit 2: User Interface Components with Swing
                • Unit 3: Event Handling
                • Unit 4: Database Connectivity
                • Unit 5: Network Programming
                • Unit 6: GUI with JavaFX
        • Unit7
          • src
            • main
              • webapp
                • index
      • Lab Codes
        • Lab
          • src
            • main
              • java
                • Practical 1
                • Practical 2
                • Practical 3
                • Practical 4
                • Practical5
    • Data warehouse and Data mining
  • docs
    • Contributor Covenant Code of Conduct
Powered by GitBook
On this page

Was this helpful?

  1. 7th Semester
  2. Advanced Java Programming
  3. Lab Codes
  4. Lab
  5. src
  6. main
  7. java

Practical 1

PreviousjavaNextPractical 2

Last updated 8 months ago

Was this helpful?

  1. Write a program to create a class, instance variable, constructor and method. After this create a class FirstDemo with main method and access the member of above class.

    Theory:

    • Class: A blueprint for creating objects. A class encapsulates data for the object and methods to manipulate that data.

    • Instance Variable: A variable that is defined in a class for which each instantiated object of the class has a separate copy.

    • Constructor: A special method that is called when an object is instantiated. It is used to initialize the object.

    • Method: A function defined in a class that operates on instances of that class.

  2. Write a program to create one dimensional and multidimensional array and display the array using for and for each loop. All the data of array should be taken from user.

    Theory:

    • One-Dimensional Array: A list of elements of the same type.

    • Multidimensional Array: An array of arrays, where each element is itself an array.

  3. Write a program to demonstrate method overloading condition.

    Theory:

    Defining multiple methods with the same name but different parameters within the same class. It allows a class to have more than one method having the same name, if their parameter lists are different.

  4. Write a program to demonstrate single level and multi-level inheritance.

    Theory:

    • Inheritance: The mechanism by which one class acquires the properties and behavior of another class.

    • Single Inheritance: A class can inherit from only one class.

    • Multi-Level Inheritance: A class can inherit from another class, which in turn can inherit from another class.

    • Done by using the extends keyword.

    • Example: class Child extends Parent

  5. Provide an example of single inheritance of your choice. (Two child class inheriting single parent class).

    Theory:

    • Single Inheritance: A class can inherit from only one class.

  6. Provide an example of multi-level inheritance of your choice.

    Theory:

    • Multi-Level Inheritance: A class can inherit from another class, which in turn can inherit from another class.

  7. Provide example on how constructor of super class is called.

    Theory:

    • Super Class: The class from which a subclass inherits.

    • Super Keyword: Used to refer to the superclass of the class in which it appears.

    • Superclass Constructor: The constructor of the superclass.

  8. Provide example on method overriding condition.

    Theory:

    • Method Overriding: A subclass providing a specific implementation of a method that is already provided by its superclass.

    • Overriding Condition: The method in the subclass must have the same name, same parameters or signature, and same return type as the method in the superclass.

  9. Provide example on dynamic method dispatch.

    Theory:

    • Dynamic Method Dispatch: The mechanism by which a call to an overridden method is resolved at runtime, rather than compile-time.

    • Polymorphism: The ability of an object to take on many forms.

    • Method Overriding: A subclass providing a specific implementation of a method that is already provided by its superclass.

  10. Demonstrate multiple inheritance using interface.

    Theory:

    • Multiple Inheritance: A class can inherit from more than one class.

    • Done by using the implements keyword.

    • Interface is used to achieve multiple inheritance in Java.

  11. Demonstrate inheritance in interface (extending the interface).

    Theory:

    • Interface: A reference type in Java, similar to a class, that can contain only constants, method signatures, default methods, static methods, and nested types.

    • Inheritance in Interface: An interface can inherit from another interface.

  12. Write a program to demonstrate multithreading using both Thread class and Runnable interface.

    Theory:

    • Multithreading: The ability of a CPU to execute multiple threads concurrently.

    • Thread Class: A class in Java that provides methods to create and perform operations on a thread.

    • Runnable Interface: An interface in Java that provides a method to run a thread.

    • Thread: A path of execution within a program.

    • Concurrency: The ability of different parts or units of a program, algorithm, or problem to be executed out-of-order or in partial order, without affecting the final outcome.

    • Synchronization: The coordination of multiple threads to prevent conflicts

    • Deadlock: A situation where two or more threads are waiting for each other to release a resource, preventing them from continuing.

  13. Write a program to demonstrate inter thread communication.

    Theory:

    • Inter-Thread Communication: The process of communication between two or more threads.

    • wait(): Causes the current thread to wait until another thread invokes the notify() method or the notifyAll() method for this object.

    • notify(): Wakes up a single thread that is waiting on this object's monitor.

    • notifyAll(): Wakes up all threads that are waiting on this object's monitor.

  14. Write a program to demonstrate reading and writing data in file.

    Theory:

    • File Handling: The process of working with files on a computer.

    • Reading Data: The process of reading data from a file is performed using input streams like BufferedReader.

    • Writing Data: The process of writing data to a file is performed using output streams like BufferedWriter.

  15. Write a program to demonstrate serialization and deserialization.

    Theory:

    • Serialization: The process of converting an object into a stream of bytes to store the object or transmit it to memory, a database, or a file.

    • Deserialization: The process of converting a stream of bytes back into an object.

Solution
Solution
Solution
Solution
Solution
Solution
Solution
Solution
Solution
Solution
Solution
Solution
Solution
Solution
Solution