The document contains code for 9 Java programming practical assignments. The first practical accepts coefficients for a quadratic equation, calculates the roots and outputs the results. The second accepts two matrices as input and calculates their addition. The third sorts an array of strings in ascending order. The fourth creates an Animal interface and classes that implement it to demonstrate polymorphism. The remaining practicals demonstrate inheritance, exceptions, GUI programming using Swing components, and the List interface.
This document contains source code for several Java programs that demonstrate concepts related to networking and URLs. The programs cover topics like retrieving a URL, getting URL information, working with InetAddress, demonstrating parts of a URL, and connectionless and connection-oriented communication between a server and client using UDP and TCP sockets. The code examples are accompanied by expected output.
The document contains 21 code snippets showing examples of various Java programming concepts. The code snippets cover topics such as classes and objects, inheritance, interfaces, exceptions, threads, applets, packages, input/output, and networking.
The document contains code snippets for various Java programs that perform tasks like calculating the area of a circle, finding the factorial of a number, displaying prime numbers, sorting an array, counting characters in a string, reversing a string, creating and running threads, handling exceptions, and creating a simple applet with buttons to change the background color. The code examples demonstrate basic Java programming concepts like classes, methods, loops, arrays, exceptions, threads, applets, and event handling.
Important java programs(collection+file)Alok Kumar
The document contains 6 Java programming questions and solutions:
1. A program to find unique and duplicate items in an array.
2. A Product class with properties and methods to sort objects.
3. A program to merge contents of two text files into a third file.
4. A program to count the occurrences of specific words in a file.
5. A program to read a file, add contents to an ArrayList, and write to a new file.
6. A program to print consecutive characters in a string and their frequency.
The document contains code snippets in Java for getting different types of information. This includes code to get the hostname, month from a date, IP address, memory size and usage, and more. The code uses various Java classes and methods like InetAddress, DateFormat, Runtime etc. to retrieve the desired information and print/return the output.
This document contains code examples demonstrating basic Java concepts like classes, objects, methods, constructors, static variables, and more. The examples show how to define Box classes with width, length and height attributes to calculate and print the volume. Later examples demonstrate method overloading, the use of this keyword, call by value vs reference, and default values of attributes. Constructors are used to initialize object attribute values.
The document contains code snippets for several Java programs including:
1. An Armstrong number checker that uses recursion to check if a number is an Armstrong number.
2. A binary search program that searches an integer array using a binary search algorithm.
3. A binary search on a float array using the Arrays binarySearch method.
The document then continues with additional code examples for recursive binary search, bubble sort, constructors, converting between object and primitive types, data input/output streams, encapsulation, enumerating a vector, exception handling, and creating threads by extending the Thread class.
program list:
WAP program to show constructor overloading using static member.
WAP to implement multilevel inheritance and method overriding.
WAP to implement interface class and show use of package.
WAP to implement multilevel exception handling and create your own exception.
WAP to implement 3 threads such that 1st sleeps for 200ms, 2nd for 400ms and 3rd for 600ms.
WAP to create applet of moving banner.
WAP to make a simple calculator.
Build a client server chat application.
This document contains source code for several Java programs that demonstrate concepts related to networking and URLs. The programs cover topics like retrieving a URL, getting URL information, working with InetAddress, demonstrating parts of a URL, and connectionless and connection-oriented communication between a server and client using UDP and TCP sockets. The code examples are accompanied by expected output.
The document contains 21 code snippets showing examples of various Java programming concepts. The code snippets cover topics such as classes and objects, inheritance, interfaces, exceptions, threads, applets, packages, input/output, and networking.
The document contains code snippets for various Java programs that perform tasks like calculating the area of a circle, finding the factorial of a number, displaying prime numbers, sorting an array, counting characters in a string, reversing a string, creating and running threads, handling exceptions, and creating a simple applet with buttons to change the background color. The code examples demonstrate basic Java programming concepts like classes, methods, loops, arrays, exceptions, threads, applets, and event handling.
Important java programs(collection+file)Alok Kumar
The document contains 6 Java programming questions and solutions:
1. A program to find unique and duplicate items in an array.
2. A Product class with properties and methods to sort objects.
3. A program to merge contents of two text files into a third file.
4. A program to count the occurrences of specific words in a file.
5. A program to read a file, add contents to an ArrayList, and write to a new file.
6. A program to print consecutive characters in a string and their frequency.
The document contains code snippets in Java for getting different types of information. This includes code to get the hostname, month from a date, IP address, memory size and usage, and more. The code uses various Java classes and methods like InetAddress, DateFormat, Runtime etc. to retrieve the desired information and print/return the output.
This document contains code examples demonstrating basic Java concepts like classes, objects, methods, constructors, static variables, and more. The examples show how to define Box classes with width, length and height attributes to calculate and print the volume. Later examples demonstrate method overloading, the use of this keyword, call by value vs reference, and default values of attributes. Constructors are used to initialize object attribute values.
The document contains code snippets for several Java programs including:
1. An Armstrong number checker that uses recursion to check if a number is an Armstrong number.
2. A binary search program that searches an integer array using a binary search algorithm.
3. A binary search on a float array using the Arrays binarySearch method.
The document then continues with additional code examples for recursive binary search, bubble sort, constructors, converting between object and primitive types, data input/output streams, encapsulation, enumerating a vector, exception handling, and creating threads by extending the Thread class.
program list:
WAP program to show constructor overloading using static member.
WAP to implement multilevel inheritance and method overriding.
WAP to implement interface class and show use of package.
WAP to implement multilevel exception handling and create your own exception.
WAP to implement 3 threads such that 1st sleeps for 200ms, 2nd for 400ms and 3rd for 600ms.
WAP to create applet of moving banner.
WAP to make a simple calculator.
Build a client server chat application.
The document outlines a Java programming practical course covering various Java concepts and programs. It includes 40 practical programs to be completed ranging from basic programs to find area of a circle, factorial of a number to more advanced programs involving OOP concepts like inheritance, abstraction, exception handling and multithreading. It also provides the evaluation and marking scheme for the practical exam.
This document presents 8 Java puzzles to demonstrate common programming pitfalls. The puzzles cover issues like static methods overriding instead of overloading, violating the equals and hashCode contracts for objects, abrupt returns in finally blocks, integer overflows when subtracting large numbers, operator overloading with characters, ambiguous constructor overloading, implicit type promotions between primitives, and comparing values of different types. For each puzzle, it provides the expected output and an explanation of what is happening, along with suggestions for how to fix the problem code. The overall goals are to have fun while learning about quirks in Java programming and how to avoid common mistakes.
This document contains a Java practical file belonging to Rachit Gupta, an MCA student. It consists of 16 programs of varying complexity written in Java, along with the output of each program. The programs cover topics such as calculating the square root of a number, finding the perimeter of a rectangle, calculating percentage of marks, and generating an electric bill based on units consumed. The file is a submission of Rachit Gupta's Java practical assignments for his 4th semester MCA course at the University of Jammu.
This document provides an overview of Spock, a testing framework for Java and Groovy. It describes how to include Spock tests in a project, run Spock tests, debug Spock tests, view test coverage, and integrate Spock tests with Sonar. It also explains Spock specifications, feature methods, blocks like setup, when/then, expect, and cleanup. It demonstrates how to write conditions, handle exceptions, create helper methods, mocks, stubs, and spies in Spock tests.
This document discusses using the F# programming language for unit testing. It provides examples of writing unit tests in F# using different testing frameworks like NUnit, FsUnit, and Unquote. It also shows how to mock objects and set up expected behavior using mocking libraries in F# like Moq, FakeItEasy, and Foq. Foq is a mocking library for F# that allows mocking using code quotations or a fluent interface. The document compares the lines of code of different mocking libraries and versions of Foq. It promotes F# as an effective testing language.
Spock is a testing and specification framework for Java and Groovy applications. It allows writing tests in a business-readable style using specifications with setup, expect, when, then blocks. Tests are highly readable and maintainable. Spock supports mocking collaborators, defining mock behavior and interactions, parameterizing tests, and extending tests with annotations. It provides a highly logical way to write well-described and concise tests.
The document provides an index and descriptions of various topics related to web development including:
1. The modulus operator and examples of using it to check for divisibility.
2. Relational and logical operators like greater than, less than, equal to and examples of using them in code.
3. Descriptions of do-while and for loops with examples.
4. An example using a parameterized constructor to initialize cube dimensions.
5. Examples of string methods like startsWith, length, and trim.
6. Descriptions and examples of overloading methods and constructors.
7. An example of inheritance with overriding methods.
8. An interface example with animal classes
The document discusses networking concepts like client-server communication and provides code examples of an echo server and client. It explains how a client and server can communicate by creating sockets to connect to each other on a specified port, then reading from and writing to each other's input and output streams. The document also provides an example of a multi-threaded echo server that handles multiple clients concurrently by creating a new thread for each client. Finally, it discusses a quote server that uses UDP to send a random quote to clients in response to receiving an empty datagram packet from them.
The document discusses topics related to just-in-time (JIT) compilation in the Java Virtual Machine (JVM). It explains that the JIT compiler is triggered when methods are invoked many times based on invocation and back-edge counters, compiling frequently used code to machine code for improved performance. It also discusses why ahead-of-time compilation is not well-suited for Java due to its dynamic nature, and what can cause compiled code to be deoptimized, such as class initialization failures, null pointer exceptions, and unstable control flow.
The document provides code examples for several Java programming concepts:
1. A program that takes command line arguments, calculates the sum and average of the numbers passed, and displays the results.
2. A Student class with member functions to read and display student details like name and age.
3. A Square class with data members for length, area, and perimeter, and member functions to read, compute values, and display details.
The document contains 10 additional examples covering topics like inheritance, packages, exceptions, threads, and GUI programming.
Spock is a Groovy-based testing framework that provides features for writing tests in a clear, expressive, and highly readable manner. Some key features highlighted in the document include:
- Spock tests are structured into blocks like "given", "when", "then" that give tests a clear structure and meaning.
- Spock includes powerful and easy to read assertion methods as well as the ability to display diffs when expectations are not met.
- Spock supports mocking and stubbing of dependencies in a simple way.
- Data-driven testing is first-class in Spock through features like the "where" block that allows input test data to be specified in a table.
This document discusses Java Database Connectivity (JDBC) and provides examples of connecting to and querying databases using JDBC. It covers the basic steps to connect to a database which include loading the driver, creating a connection, creating statements, and executing queries. Examples are given for connecting to MySQL and retrieving and updating data. Additional topics covered include prepared statements, mapping Java types to SQL types, and using JavaBeans and Data Access Objects for database operations.
Using Fuzzy Code Search to Link Code Fragments in Discussions to Source CodeNicolas Bettenburg
Talk on Using Fuzzy Code Search to Link Code Fragments in Discussions to Source Code, given at the 16th European Conference on Software Maintenance and Reengineering (CSMR'12) in Hungary.
Here are the steps to move the frontend out of the Main class and into its own thread:
1. Create a Frontend class that extends AbstractHandler and implements Runnable
2. Move the frontend handling logic from Main into the run() method of Frontend
3. Add a handleCount field to Frontend of type AtomicInteger
4. In the run() method, periodically log the value of handleCount every 5 seconds
5. In the handle() method, increment handleCount using getAndIncrement() after generating the page
6. From Main, instantiate a Frontend object and call start() on its thread to run asynchronously
This will separate the frontend into its own thread of execution. The handleCount field
The document contains code snippets from 3 weekly coding assignments:
1) A Java program to check if a string is a palindrome. It compares characters at the beginning and end of the string.
2) A Java program to sort a list of names in ascending order using string comparison and swapping.
3) A Java program to count the frequency of words in a given text by tokenizing, sorting, and printing the words.
The document contains 17 code snippets that demonstrate various Java programming concepts like loops, arrays, methods, classes, input/output, etc. Specifically, the code snippets show:
1. Using for loops to print numeric series
2. Accepting user input of different data types using Scanner and parsing
3. Using StringTokenizer and Scanner classes
4. Finding largest number among 3 inputs and printing tables
5. Demonstrating 2D arrays, array of objects, and command line arguments
6. Various String class methods like length(), substring(), indexOf() etc.
The document contains 21 programming problems involving Java concepts like arrays, loops, methods, classes, objects, constructors, and more. For each problem, source code is provided to demonstrate how to solve the problem, followed by sample output. Some key problems include: (1) printing series using nested loops, (2) receiving user input of different data types, (3) using StringTokenizer and Scanner classes, (4) finding largest of 3 numbers, (5) using 2D arrays and array of objects.
The document outlines a Java programming practical course covering various Java concepts and programs. It includes 40 practical programs to be completed ranging from basic programs to find area of a circle, factorial of a number to more advanced programs involving OOP concepts like inheritance, abstraction, exception handling and multithreading. It also provides the evaluation and marking scheme for the practical exam.
This document presents 8 Java puzzles to demonstrate common programming pitfalls. The puzzles cover issues like static methods overriding instead of overloading, violating the equals and hashCode contracts for objects, abrupt returns in finally blocks, integer overflows when subtracting large numbers, operator overloading with characters, ambiguous constructor overloading, implicit type promotions between primitives, and comparing values of different types. For each puzzle, it provides the expected output and an explanation of what is happening, along with suggestions for how to fix the problem code. The overall goals are to have fun while learning about quirks in Java programming and how to avoid common mistakes.
This document contains a Java practical file belonging to Rachit Gupta, an MCA student. It consists of 16 programs of varying complexity written in Java, along with the output of each program. The programs cover topics such as calculating the square root of a number, finding the perimeter of a rectangle, calculating percentage of marks, and generating an electric bill based on units consumed. The file is a submission of Rachit Gupta's Java practical assignments for his 4th semester MCA course at the University of Jammu.
This document provides an overview of Spock, a testing framework for Java and Groovy. It describes how to include Spock tests in a project, run Spock tests, debug Spock tests, view test coverage, and integrate Spock tests with Sonar. It also explains Spock specifications, feature methods, blocks like setup, when/then, expect, and cleanup. It demonstrates how to write conditions, handle exceptions, create helper methods, mocks, stubs, and spies in Spock tests.
This document discusses using the F# programming language for unit testing. It provides examples of writing unit tests in F# using different testing frameworks like NUnit, FsUnit, and Unquote. It also shows how to mock objects and set up expected behavior using mocking libraries in F# like Moq, FakeItEasy, and Foq. Foq is a mocking library for F# that allows mocking using code quotations or a fluent interface. The document compares the lines of code of different mocking libraries and versions of Foq. It promotes F# as an effective testing language.
Spock is a testing and specification framework for Java and Groovy applications. It allows writing tests in a business-readable style using specifications with setup, expect, when, then blocks. Tests are highly readable and maintainable. Spock supports mocking collaborators, defining mock behavior and interactions, parameterizing tests, and extending tests with annotations. It provides a highly logical way to write well-described and concise tests.
The document provides an index and descriptions of various topics related to web development including:
1. The modulus operator and examples of using it to check for divisibility.
2. Relational and logical operators like greater than, less than, equal to and examples of using them in code.
3. Descriptions of do-while and for loops with examples.
4. An example using a parameterized constructor to initialize cube dimensions.
5. Examples of string methods like startsWith, length, and trim.
6. Descriptions and examples of overloading methods and constructors.
7. An example of inheritance with overriding methods.
8. An interface example with animal classes
The document discusses networking concepts like client-server communication and provides code examples of an echo server and client. It explains how a client and server can communicate by creating sockets to connect to each other on a specified port, then reading from and writing to each other's input and output streams. The document also provides an example of a multi-threaded echo server that handles multiple clients concurrently by creating a new thread for each client. Finally, it discusses a quote server that uses UDP to send a random quote to clients in response to receiving an empty datagram packet from them.
The document discusses topics related to just-in-time (JIT) compilation in the Java Virtual Machine (JVM). It explains that the JIT compiler is triggered when methods are invoked many times based on invocation and back-edge counters, compiling frequently used code to machine code for improved performance. It also discusses why ahead-of-time compilation is not well-suited for Java due to its dynamic nature, and what can cause compiled code to be deoptimized, such as class initialization failures, null pointer exceptions, and unstable control flow.
The document provides code examples for several Java programming concepts:
1. A program that takes command line arguments, calculates the sum and average of the numbers passed, and displays the results.
2. A Student class with member functions to read and display student details like name and age.
3. A Square class with data members for length, area, and perimeter, and member functions to read, compute values, and display details.
The document contains 10 additional examples covering topics like inheritance, packages, exceptions, threads, and GUI programming.
Spock is a Groovy-based testing framework that provides features for writing tests in a clear, expressive, and highly readable manner. Some key features highlighted in the document include:
- Spock tests are structured into blocks like "given", "when", "then" that give tests a clear structure and meaning.
- Spock includes powerful and easy to read assertion methods as well as the ability to display diffs when expectations are not met.
- Spock supports mocking and stubbing of dependencies in a simple way.
- Data-driven testing is first-class in Spock through features like the "where" block that allows input test data to be specified in a table.
This document discusses Java Database Connectivity (JDBC) and provides examples of connecting to and querying databases using JDBC. It covers the basic steps to connect to a database which include loading the driver, creating a connection, creating statements, and executing queries. Examples are given for connecting to MySQL and retrieving and updating data. Additional topics covered include prepared statements, mapping Java types to SQL types, and using JavaBeans and Data Access Objects for database operations.
Using Fuzzy Code Search to Link Code Fragments in Discussions to Source CodeNicolas Bettenburg
Talk on Using Fuzzy Code Search to Link Code Fragments in Discussions to Source Code, given at the 16th European Conference on Software Maintenance and Reengineering (CSMR'12) in Hungary.
Here are the steps to move the frontend out of the Main class and into its own thread:
1. Create a Frontend class that extends AbstractHandler and implements Runnable
2. Move the frontend handling logic from Main into the run() method of Frontend
3. Add a handleCount field to Frontend of type AtomicInteger
4. In the run() method, periodically log the value of handleCount every 5 seconds
5. In the handle() method, increment handleCount using getAndIncrement() after generating the page
6. From Main, instantiate a Frontend object and call start() on its thread to run asynchronously
This will separate the frontend into its own thread of execution. The handleCount field
The document contains code snippets from 3 weekly coding assignments:
1) A Java program to check if a string is a palindrome. It compares characters at the beginning and end of the string.
2) A Java program to sort a list of names in ascending order using string comparison and swapping.
3) A Java program to count the frequency of words in a given text by tokenizing, sorting, and printing the words.
The document contains 17 code snippets that demonstrate various Java programming concepts like loops, arrays, methods, classes, input/output, etc. Specifically, the code snippets show:
1. Using for loops to print numeric series
2. Accepting user input of different data types using Scanner and parsing
3. Using StringTokenizer and Scanner classes
4. Finding largest number among 3 inputs and printing tables
5. Demonstrating 2D arrays, array of objects, and command line arguments
6. Various String class methods like length(), substring(), indexOf() etc.
The document contains 21 programming problems involving Java concepts like arrays, loops, methods, classes, objects, constructors, and more. For each problem, source code is provided to demonstrate how to solve the problem, followed by sample output. Some key problems include: (1) printing series using nested loops, (2) receiving user input of different data types, (3) using StringTokenizer and Scanner classes, (4) finding largest of 3 numbers, (5) using 2D arrays and array of objects.
The document contains 15 Java programs demonstrating various programming concepts:
1. A "Hello World" program to print text
2. A class defining student attributes and methods to input/display student data
3. A class demonstrating constructor and method overloading
4. A program implementing command line arguments
5. A program demonstrating methods of the String class
The document contains the solutions to 64 programming problems in Java. It provides the code to write programs that can:
1) Display patterns like right angle triangles and pyramids with numbers.
2) Check if a number is negative, zero or positive.
3) Sort arrays and insert or find elements in arrays.
4) Perform operations like calculating averages and separating even/odd numbers in arrays.
3) Find pair sums and rotate/add matrices.
Object Oriented Solved Practice Programs C++ ExamsMuhammadTalha436
The question asks to create classes to represent publications, books, and tapes. The Publication class has title and price attributes. The Book class inherits from Publication and adds a noOfPages attribute. The Tape class inherits from Publication and adds a playingTime attribute.
The document provides examples of various Java programming concepts like displaying messages, using control structures like if-else, for loops, methods, constructors, access specifiers, static variables and more. It shows how to write simple Java programs to print messages, integers, use conditional and looping statements. It also explains concepts like default and parameterized constructors, static and non-static methods, different access specifiers and their usage. The examples help learn how different Java features can be used to develop programs with classes, objects and methods.
This document discusses how to take input from users in Java using the Scanner class. It provides examples of taking integer, double, character and string input. The Scanner class methods like nextInt(), nextDouble(), next() etc are used to read input. The document also contains sample code and explanations for taking input to calculate sum of two numbers, simple interest and reading a character.
This document provides a manual for a Java and J2EE lab for 5th semester computer science students. It contains 15 programs covering topics like enums, annotations, collections, strings, servlets, and database connectivity. Each program is explained and the expected output is provided. The programs demonstrate core Java concepts and commonly used APIs for collections, strings, I/O, and database access.
This document contains 9 Java programming assignments from a BCA semester course. Each assignment demonstrates a different Java concept such as typecasting, bitwise operators, string operations, inheritance, polymorphism, packages, interfaces, threads, and abstract classes. The assignments include code snippets to demonstrate the concepts and the expected output when the code is compiled and run.
Internet and Web Technology (CLASS-16) [Basic Elements of Java Program] | NIC...Ayes Chinmay
The document discusses various concepts in Java programming including basic elements of Java programs, strings, date and time, switch statements, methods, recursion, polymorphism through method overloading and overriding, user input, and sample questions. It provides code examples to demonstrate strings, date/time, switch statements, methods, recursion, polymorphism, and user input. It also defines method overloading and overriding and compares the two.
The document provides examples of Java code demonstrating various programming concepts like loops, conditional statements, methods, arrays and string manipulation. It includes code snippets to print "Hello World", check if a number is even or odd, print multiplication tables, convert temperatures between Fahrenheit and Celsius scales, take input from the user and perform basic operations on strings. The examples illustrate the use of various loops like for, while and do-while loops, if-else statements, methods and built-in string/array methods in Java.
The document discusses different ways to implement threading in Java programs. It provides code examples to demonstrate creating threads by extending the Thread class and implementing the Runnable interface. The code examples show printing output from both the main thread and child threads to illustrate threading concepts. Socket programming and RMI examples are also provided with code to implement client-server applications using threads.
import java.util.;public class Program{public static void.pdfoptokunal1
import java.util.*;
public class Program
{
public static void main(String[] args) {
Scanner input = new Scanner(System.in);
String x=\"X\";
int amount;
System.out.println(\"Enter amount\");
amount=input.nextInt();
System.out.println(\"Amount is: \"+amount);
for(int i=1; i<=amount; i++)
{
System.out.println(x);
for(int j=1; j<=i; j++)
{
System.out.print(x);
}
}
}
}
Why does It print out the last set of X\'s twice? I am doing basic Java so please try to explain
using the most basic codes.
import java.util.*;
public class Program
{
public static void main(String[] args) {
Scanner input = new Scanner(System.in);
String x=\"X\";
int amount;
System.out.println(\"Enter amount\");
amount=input.nextInt();
System.out.println(\"Amount is: \"+amount);
for(int i=1; i<=amount; i++)
{
System.out.println(x);
for(int j=1; j<=i; j++)
{
System.out.print(x);
}
}
}
}
Why does It print out the last set of X\'s twice? I am doing basic Java so please try to explain
using the most basic codes.
import java.util.*;
public class Program
{
public static void main(String[] args) {
Scanner input = new Scanner(System.in);
String x=\"X\";
int amount;
System.out.println(\"Enter amount\");
amount=input.nextInt();
System.out.println(\"Amount is: \"+amount);
for(int i=1; i<=amount; i++)
{
System.out.println(x);
for(int j=1; j<=i; j++)
{
System.out.print(x);
}
}
}
}
Why does It print out the last set of X\'s twice? I am doing basic Java so please try to explain
using the most basic codes.
Solution
Hi,
I have modified the code. it is working as expected now. Highlighted the code changes below.
Issue here is with you have written this statement twice System.out.println(x); which causes the
issue.
Program.java
import java.util.*;
public class Program
{
public static void main(String[] args) {
Scanner input = new Scanner(System.in);
String x=\"X\";
int amount;
System.out.println(\"Enter amount\");
amount=input.nextInt();
System.out.println(\"Amount is: \"+amount);
for(int i=1; i<=amount; i++)
{
System.out.println();
for(int j=1; j<=i; j++)
{
System.out.print(x);
}
}
}
}
Output:
Enter amount
10
Amount is: 10
X
XX
XXX
XXXX
XXXXX
XXXXXX
XXXXXXX
XXXXXXXX
XXXXXXXXX
XXXXXXXXXX.
This document contains instructions for several Java programming exercises involving classes, packages, inheritance, overriding, exceptions, and threads. It outlines code for programs that demonstrate concepts like classes and objects, command line arguments, bitwise operators, method overriding, and packages. For each exercise, it provides the aim, algorithm, sample code, input/output, and result to verify the output. The exercises are intended to help students learn and practice core Java programming concepts.
The document discusses Java's Math and Random classes. It provides examples of how to use common Math class methods like pow(), abs(), ceil(), floor(), max(), min(), and sqrt() to calculate powers, absolute values, rounding, maximum/minimum values, and square roots of numbers. It also shows how to generate random numbers between 0-5 using the Random class's nextInt() method.
The document contains 10 Java programs demonstrating various Java concepts:
1. Constructor overloading and method overloading using a Box class.
2. Inner classes and access protections using an Outer and Inner class.
3. Inheritance using classes A and B, with B extending A.
4. Exception handling using nested try-catch blocks.
5. Linked list operations using a LinkedList class.
6. File input/output streams using FileInputStream and FileOutputStream.
7. Object serialization writing an object to a file.
8. Client-server communication using datagram sockets.
9. Mouse event handling using MouseListener and MouseMotionListener interfaces.
10. Keyboard event handling using the
This Java code defines a class called Soal07 that contains a main method for managing a student mark list. The main method uses Scanner objects to accept user input. It displays a menu with options to input student data, view all data, edit data, or exit. Based on the user's selection, it will either prompt the user to enter information for multiple students, display an existing student's data, or allow editing of an existing student's data by re-prompting for input. All student data, including name, ID, and mark, is stored in arrays.
The document discusses transactions in database management systems and the ACID properties that transactions must satisfy. It describes the four ACID properties - atomicity, consistency, isolation, and durability. Atomicity ensures that transactions are treated as an atomic unit and either fully occur or not at all. Consistency requires that transactions alone preserve the consistency of the database. Isolation ensures that concurrently executing transactions are isolated from each other. Durability means the effects of committed transactions persist even if the system crashes. The document also discusses transaction schedules, concurrency control, and anomalies that can occur with concurrent transaction execution.
T.Y.B.S.CS Advance Java Practicals Sem 5 Mumbai UniversityNiraj Bharambe
This document contains source code from multiple Java practical assignments involving Swing controls and database connectivity using JDBC. It includes source code for creating GUI elements like buttons, menus, scrollbars etc. using Swing controls. It also includes source code examples for performing database operations like creating tables, inserting data, and displaying data from tables using JDBC. The output of each practical is also displayed.
Python Book/Notes For Python Book/Notes For S.Y.B.Sc. I.T.Niraj Bharambe
This document provides an introduction to the Python programming language. It discusses that Python is a high-level language that is easier for humans to write and understand compared to low-level languages. It can be compiled into byte code or interpreted. The document then discusses the history and origins of Python, its key features like being easy to learn and maintain, and how to install Python on different operating systems. It also covers running Python programs, debugging techniques, and setting the Python environment path and variables.
The document describes developing an advanced Enterprise Java Bean that allows a user to enter registration details in a Registration.jsp form. The data entered by the user is then stored in a database.
Registration.jsp collects the user input fields like username, password, first name, last name and email from the request parameters. JDBC is used to connect to a MySQL database and a prepared statement is executed to insert the user details into a database table. On successful insertion, a message is displayed confirming successful registration.
This document provides an overview and tutorial for learning the Java programming language. It begins with an introduction to Java and its history and tools needed. It then discusses setting up the Java environment and popular Java editors. The document provides tutorials on basic Java syntax, including variables, data types, objects, classes and modifiers. It includes many code examples to illustrate concepts. The goal is to give beginners a practical understanding of Java from basic to advanced topics.
The document discusses defining client access to enterprise beans through interfaces. It covers:
- Session and entity beans use interfaces to define client access, while message-driven beans do not.
- Well-designed interfaces simplify application development and maintenance by shielding clients from bean complexities and allowing internal bean changes.
- Clients can access beans remotely, locally, or through web services, and the document discusses the characteristics of each type of client access.
The servlet code reads the name and age parameters from an HTML form submitted via GET. It uses the getParameter() method to retrieve the parameter values and prints them out wrapped in HTML.
The document discusses enterprise beans, which are server-side components that encapsulate business logic in Java applications. There are three types of enterprise beans: session beans, entity beans, and message-driven beans. Session beans represent a single client and are not persistent, while entity beans represent business objects that are stored persistently in a database. The document provides details on session beans and entity beans, including their purposes, characteristics, and when each type should be used.
This document provides an introduction and overview of XML. It defines XML, explains how it is used to transport and store data, and compares it to HTML. It provides examples of XML code and documents. It describes XML syntax rules including requirements for closing tags, nesting, and attributes. It explains how XML documents form a tree structure and defines key XML concepts like elements, attributes, comments and naming conventions.
This document provides an introduction to HTML and teaches the basics of creating web pages using HTML. It explains key HTML elements and tags like <html>, <body>, <h1>, <p>, and <img> and how they are used to structure an HTML document and define headings, paragraphs, links and images. The document also covers HTML attributes, headings from <h1> to <h6>, empty elements like <br>, and the importance of properly opening and closing all HTML tags.
The document discusses color values in HTML. It explains that colors are created by combining levels of red, green, and blue light, which can be represented using hexadecimal notation. With 256 possible values for each color component, there are over 16 million possible colors that can be generated. Examples of common color values in hexadecimal and RGB notation are provided.
Sixth Sense Technology allows users to seamlessly access and interact with digital information in the physical world using hand gestures. It works by projecting digital interfaces onto physical surfaces using a mini projector, camera, and cell phone. The current prototype costs $350 and implements applications that demonstrate its usefulness for tasks like making calls, accessing maps, checking the time, drawing, zooming, getting product/book information, taking pictures, and more - essentially giving users a "sixth sense" of accessing information beyond their five physical senses.
Sixth Sense is a wearable device developed by Pranav Mistry that uses a camera, projector, and mirror coupled with a mobile phone to augment the physical world with digital information. It allows users to access information about their environment or objects by pointing their hands, and interact with this information using natural hand gestures. The camera recognizes hand gestures and objects, sends this data to the connected mobile phone for processing, and the projector projects the output back onto physical surfaces and objects, blending digital information with the physical world. This effectively gives users a "sixth sense" by bringing intangible online information into the tangible world in a seamless way.
The document describes a program for detecting collisions between 2D objects using the min-max test or bounding box test. The min-max test detects collisions by comparing the minimum and maximum x and y coordinates of two objects' bounding boxes. If the minimum x of one object is greater than the maximum x of the other (or vice versa for y), no collision is possible. The C code provided implements these collision detection algorithms by finding the min-max coordinates of rectangles and testing if a moving line intersects any rectangles.
The document discusses HTML color codes. Colors are created by combining levels of red, green, and blue light, with each color value ranging from 00 to FF in hexadecimal notation. This provides over 16 million possible colors. Common colors like black, white, red, green, blue etc are given with their hexadecimal and RGB values. Shades of gray are also shown, created by using equal levels of the three primary colors. Earlier, 216 "web safe" colors were defined to work on all systems supporting 256 colors.
This document contains details of 11 practical experiments conducted using an AT90S8535 microcontroller. Each experiment is summarized in 3 sentences or less:
1. Toggle the state of LEDs connected to two ports by alternately setting the ports high and low with a 0.5 second delay.
2. Simulate an 8-bit binary counter by incrementing the port value and lighting LEDs one by one with a 0.2 second delay.
3. Generate a 1 second delay by toggling an LED connected to one port using a timer overflow interrupt that increments a counter.
1. The document outlines the steps to install Oracle database software and create a database using the Oracle Database Configuration Assistant. It describes installing the Oracle software, configuring the listener, and the 10 steps to create a new database using the assistant.
2. Key steps include choosing an installation type of "Single Instance", selecting the Enterprise Edition, accepting default path names, and choosing the "Data Warehouse" template to create a database named "ACMEDW".
3. Configuring the listener involves adding a default listener named "LISTENER" using the TCP protocol on port 1521 before creating the database.
The document discusses the benefits of exercise for mental health. Regular physical activity can help reduce anxiety and depression and improve mood and cognitive functioning. Exercise has also been shown to boost self-esteem and can serve as a healthy way to manage stress.
Creativity for Innovation and SpeechmakingMattVassar1
Tapping into the creative side of your brain to come up with truly innovative approaches. These strategies are based on original research from Stanford University lecturer Matt Vassar, where he discusses how you can use them to come up with truly innovative solutions, regardless of whether you're using to come up with a creative and memorable angle for a business pitch--or if you're coming up with business or technical innovations.
(𝐓𝐋𝐄 𝟏𝟎𝟎) (𝐋𝐞𝐬𝐬𝐨𝐧 3)-𝐏𝐫𝐞𝐥𝐢𝐦𝐬
Lesson Outcomes:
- students will be able to identify and name various types of ornamental plants commonly used in landscaping and decoration, classifying them based on their characteristics such as foliage, flowering, and growth habits. They will understand the ecological, aesthetic, and economic benefits of ornamental plants, including their roles in improving air quality, providing habitats for wildlife, and enhancing the visual appeal of environments. Additionally, students will demonstrate knowledge of the basic requirements for growing ornamental plants, ensuring they can effectively cultivate and maintain these plants in various settings.
Decolonizing Universal Design for LearningFrederic Fovet
UDL has gained in popularity over the last decade both in the K-12 and the post-secondary sectors. The usefulness of UDL to create inclusive learning experiences for the full array of diverse learners has been well documented in the literature, and there is now increasing scholarship examining the process of integrating UDL strategically across organisations. One concern, however, remains under-reported and under-researched. Much of the scholarship on UDL ironically remains while and Eurocentric. Even if UDL, as a discourse, considers the decolonization of the curriculum, it is abundantly clear that the research and advocacy related to UDL originates almost exclusively from the Global North and from a Euro-Caucasian authorship. It is argued that it is high time for the way UDL has been monopolized by Global North scholars and practitioners to be challenged. Voices discussing and framing UDL, from the Global South and Indigenous communities, must be amplified and showcased in order to rectify this glaring imbalance and contradiction.
This session represents an opportunity for the author to reflect on a volume he has just finished editing entitled Decolonizing UDL and to highlight and share insights into the key innovations, promising practices, and calls for change, originating from the Global South and Indigenous Communities, that have woven the canvas of this book. The session seeks to create a space for critical dialogue, for the challenging of existing power dynamics within the UDL scholarship, and for the emergence of transformative voices from underrepresented communities. The workshop will use the UDL principles scrupulously to engage participants in diverse ways (challenging single story approaches to the narrative that surrounds UDL implementation) , as well as offer multiple means of action and expression for them to gain ownership over the key themes and concerns of the session (by encouraging a broad range of interventions, contributions, and stances).
Get Success with the Latest UiPath UIPATH-ADPV1 Exam Dumps (V11.02) 2024yarusun
Are you worried about your preparation for the UiPath Power Platform Functional Consultant Certification Exam? You can come to DumpsBase to download the latest UiPath UIPATH-ADPV1 exam dumps (V11.02) to evaluate your preparation for the UIPATH-ADPV1 exam with the PDF format and testing engine software. The latest UiPath UIPATH-ADPV1 exam questions and answers go over every subject on the exam so you can easily understand them. You won't need to worry about passing the UIPATH-ADPV1 exam if you master all of these UiPath UIPATH-ADPV1 dumps (V11.02) of DumpsBase. #UIPATH-ADPV1 Dumps #UIPATH-ADPV1 #UIPATH-ADPV1 Exam Dumps
CapTechTalks Webinar Slides June 2024 Donovan Wright.pptxCapitolTechU
Slides from a Capitol Technology University webinar held June 20, 2024. The webinar featured Dr. Donovan Wright, presenting on the Department of Defense Digital Transformation.
How to Create User Notification in Odoo 17Celine George
This slide will represent how to create user notification in Odoo 17. Odoo allows us to create and send custom notifications on some events or actions. We have different types of notification such as sticky notification, rainbow man effect, alert and raise exception warning or validation.
How to Download & Install Module From the Odoo App Store in Odoo 17Celine George
Custom modules offer the flexibility to extend Odoo's capabilities, address unique requirements, and optimize workflows to align seamlessly with your organization's processes. By leveraging custom modules, businesses can unlock greater efficiency, productivity, and innovation, empowering them to stay competitive in today's dynamic market landscape. In this tutorial, we'll guide you step by step on how to easily download and install modules from the Odoo App Store.
managing Behaviour in early childhood education.pptx
Core java pract_sem iii
1. PRACTICAL 1
AIM :- Accept integer values for a, b and c which are coefficients of quadratic equation. Find the solution
of quadratic equation.
Source Code:-
import java.util.Scanner;
public class pract1
{
public static void main(String[] args)
{
int a, b, c;
double root1, root2, d;
Scanner s = new Scanner(System.in);
System.out.println("Given quadratic equation:ax^2 + bx + c");
System.out.print("Enter a:");
a = s.nextInt();
System.out.print("Enter b:");
b = s.nextInt();
System.out.print("Enter c:");
c = s.nextInt();
System.out.println("Given quadratic equation:"+a+"x^2 + "+b+"x + "+c);
d = b * b - 4 * a * c;
if(d > 0)
{
System.out.println("Roots are real and unequal");
root1 = ( - b + Math.sqrt(d))/(2*a);
root2 = (-b - Math.sqrt(d))/(2*a);
System.out.println("First root is:"+root1);
System.out.println("Second root is:"+root2);
}
else if(d == 0)
{
System.out.println("Roots are real and equal");
root1 = (-b+Math.sqrt(d))/(2*a);
System.out.println("Root:"+root1);
}
else
{
System.out.println("Roots are imaginary");
}
}
}
3. PRACTICAL 2
AIM :- Accept two n x m matrices. Write a Java program to find addition of these matrices
Source Code:-
import java.util.Scanner;
class pract2
{
public static void main(String args[])
{
int m, n, c, d;
Scanner in = new Scanner(System.in);
System.out.println("Enter the number of rows and columns of matrix");
m = in.nextInt();
n = in.nextInt();
int first[][] = new int[m][n];
int second[][] = new int[m][n];
int sum[][] = new int[m][n];
System.out.println("Enter the elements of first matrix");
for ( c = 0 ; c < m ; c++ )
for ( d = 0 ; d < n ; d++ )
first[c][d] = in.nextInt();
System.out.println("Enter the elements of second matrix");
for ( c = 0 ; c < m ; c++ )
for ( d = 0 ; d < n ; d++ )
second[c][d] = in.nextInt();
for ( c = 0 ; c < m ; c++ )
for ( d = 0 ; d < n ; d++ )
sum[c][d] = first[c][d] + second[c][d]; //replace '+' with '-' to subtract matrices
System.out.println("Sum of entered matrices:-");
for ( c = 0 ; c < m ; c++ )
{
for ( d = 0 ; d < n ; d++ )
System.out.print(sum[c][d]+"t");
System.out.println();
}
}
}
5. PRACTICAL 3
AIM :- Accept n strings. Sort names in ascending order.
Source Code:-
import java.util.Scanner;
public class pract3
{
public static void main(String[] args)
{
int n;
String temp;
Scanner s = new Scanner(System.in);
System.out.print("Enter number of names you want to enter:");
n = s.nextInt();
String names[] = new String[n];
Scanner s1 = new Scanner(System.in);
System.out.println("Enter all the names:");
for(int i = 0; i < n; i++)
{
names[i] = s1.nextLine();
}
for (int i = 0; i < n; i++)
{
for (int j = i + 1; j < n; j++)
{
if (names[i].compareTo(names[j])>0)
{
temp = names[i];
names[i] = names[j];
names[j] = temp;
}
}
}
System.out.print("Names in Sorted Order:");
for (int i = 0; i < n - 1; i++)
{
System.out.print(names[i] + ",");
}
System.out.print(names[n - 1]);
}
}
7. PRACTICAL 4
AIM :- Create a package: Animals. In package animals create interface Animal with suitable
behaviors. Implement the interface Animal in the same package animals.
Source Code:-
Animals.java (interface):
interface Animals {
void callSound();
int run();
}
Feline.java (abstract class):
abstract class Feline implements Animals {
@Override
public void callSound() {
System.out.println("roar");
}
}
Canine.java (abstract class):
abstract class Canine implements Animals {
@Override
public void callSound() {
System.out.println("howl");
}
}
Lion.java (class):
class Lion extends Feline {
@Override
public void callSound() {
super.callSound();
}
@Override
public int run() {
return 40;
}
}
Cat.java (class):
class Cat extends Feline {
@Override
public void callSound() {
8. System.out.println("meow");
}
@Override
public int run() {
return 30;
}
}
Wolf.java (class):
class Wolf extends Canine {
@Override
public void callSound() {
super.callSound();
}
@Override
public int run() {
return 20;
}
}
Dog.java (class):
class Dog extends Canine {
@Override
public void callSound() {
System.out.println("woof");
super.callSound();
}
@Override
public int run() {
return 10;
}
}
Main.java:
public class Main {
public static void main(String[] args) {
Animals[] animals = new Animals[4];
animals[0] = new Cat();
animals[1] = new Dog();
animals[2] = new Wolf();
animals[3] = new Lion();
for (int i = 0; i < animals.length; i++) {
animals[i].callSound();
}
}}
10. PRACTICAL 5
AIM :- Demonstrate Java inheritance using extends keyword.
Source Code:-
Animal.java:
public class Animal {
public Animal() {
System.out.println("A new animal has been created!");
}
public void sleep() {
System.out.println("An animal sleeps...");
}
public void eat() {
System.out.println("An animal eats...");
}
}
Bird.java:
public class Bird extends Animal {
public Bird() {
super();
System.out.println("A new bird has been created!");
}
@Override
public void sleep() {
System.out.println("A bird sleeps...");
}
@Override
public void eat() {
System.out.println("A bird eats...");
}
}
Dog.java:
public class Dog extends Animal {
public Dog() {
super();
System.out.println("A new dog has been created!");
}
@Override
public void sleep() {
System.out.println("A dog sleeps...");
}
@Override
public void eat() {
11. System.out.println("A dog eats...");
}
}
MainClass.java:
public class MainClass {
public static void main(String[] args) {
Animal animal = new Animal();
Bird bird = new Bird();
Dog dog = new Dog();
System.out.println();
animal.sleep();
animal.eat();
bird.sleep();
bird.eat();
dog.sleep();
dog.eat();
}
}
13. PRACTICAL 6
AIM :- Demonstrate method overloading and method overriding in Java
Source Code:-
Method overloading:-
class Polymorphism
{
void add(int a, int b)
{
System.out.println("Sum of two="+(a+b));
}
void add(int a, int b,int c)
{
System.out.println("Sum of three="+(a+b+c));
}
}
class pract6_overloading
{
public static void main(String args[])
{
Sum s=new Sum();
s.add(10,15);
s.add(10,20,30);
}
}
OUTPUT :-
14. Method overriding:-
class Bank{
int getRateOfInterest()
{
return 0;
}
}
class SBI extends Bank
{
int getRateOfInterest()
{
return 8;
}
}
class ICICI extends Bank
{
int getRateOfInterest()
{
return 7;
}
}
class AXIS extends Bank
{
int getRateOfInterest()
{
return 9;
}
}
class pract6_overriding
{
public static void main(String args[])
{
SBI s=new SBI();
ICICI i=new ICICI();
AXIS a=new AXIS();
System.out.println("SBI Rate of Interest: "+s.getRateOfInterest());
System.out.println("ICICI Rate of Interest: "+i.getRateOfInterest());
System.out.println("AXIS Rate of Interest: "+a.getRateOfInterest());
}
}
16. PRACTICAL 7
AIM :- Demonstrate creating your own exception in Java.
Source Code:-
class NumberRangeException extends Exception
{
String msg;
NumberRangeException()
{
msg = new String("Enter a number between 20 and 100");
}
}
public class My_Exception
{
public static void main (String args [ ])
{
try
{
int x = 10;
if (x < 20 || x >100) throw new NumberRangeException( );
}
catch (NumberRangeException e)
{
System.out.println (e);
}
}
}
OUTPUT :-
17. PRACTICAL 8
AIM :- Using various swing components design Java application to accept a student's resume.
(Design form)
Source Code:-
import java.io.*;
import java.awt.*;
import java.awt.event.*;
class Frame1 extends Frame implements ActionListener
{
String msg="";
Button btnNew,btnSubmit,btnView;
Label lblName,lblAge,lblAddr,lblGender,lblQua;
TextField txtName,txtAge;
TextArea txtAddr,txtAns;
CheckboxGroup ChkGrp;
Checkbox chkMale,chkFemale;
Checkbox chkMca,chkBca,chkBba,chkMba;
Frame1(String name)
{
super(name);
setLayout(new GridLayout(3,2));
lblName = new Label("Name: ");
lblAge = new Label("Age: ");
lblAddr = new Label("Address : ");
lblGender = new Label("Gender: ");
lblQua = new Label("Qualification: ");
txtName = new TextField(20);
txtAge = new TextField(20);
txtAddr = new TextArea();
ChkGrp = new CheckboxGroup();
chkMale = new Checkbox("Male",ChkGrp,false);
chkFemale = new Checkbox("Female",ChkGrp,false);
chkMca = new Checkbox("MCA");
chkBca = new Checkbox("BCA");
chkMba = new Checkbox("MBA");
chkBba = new Checkbox("BBA");
btnNew = new Button("NEW");
btnSubmit = new Button("SUBMIT");
btnView = new Button("VIEW");
btnNew.addActionListener(this);
btnSubmit.addActionListener(this);
btnView.addActionListener(this);
add(lblName);
20. {
try{
Frame1 F = new Frame1("Biodata");
F.setSize(400,400);
F.show();
}catch(Exception e)
{
System.out.println(e);
}
}
}
OUTPUT :-
21. PRACTICAL 9
AIM :- Write a Java List example and demonstrate methods of Java List interface.
Source Code:-
import java.util.*;
public class Pract9 {
public static void main(String[] args) {
List a1 = new ArrayList();
a1.add("Zara");
a1.add("Mahnaz");
a1.add("Ayan");
System.out.println(" ArrayList Elements");
System.out.print("t" + a1);
List l1 = new LinkedList();
l1.add("Zara");
l1.add("Mahnaz");
l1.add("Ayan");
System.out.println();
System.out.println(" LinkedList Elements");
System.out.print("t" + l1);
}
}
OUTPUT :-