SlideShare uma empresa Scribd logo
1 de 4
L.D. College of Engineering
SEM: 5th Information Technology
Subject: JAVA Programming
                                      Practical List

1    Pass student name using command line argument and print output in following
     format: First Name : abc
                Second Name : pqr
                Last Name : str
2    Write a program that creates and initializes a four element byte array. Calculate and
     display the average of its values.
3.   Write an application that creates a two-dimension arrary with int values. the first,
     second, and third elements should be arrays with one, two and three numbers
     respectively. Display the length of each dimension.
4    Write a program to check whether given number is even or odd.
5    Write a program that displays the value of 2 raised to the power 12.
6.   Write a program that displays the substring formed by the last ten characters of a
     string.(Use length() method)
7    A string contains five numbers separated by commas .Write a program that displays
     the last number.
9    Write a program check primality of a number.
10   Write a program to create circle class with area function to find area of circle.
11   Define class complex with function to add and to compare to complex number.
12   Write a program to print following triangle with character ‘A’ passed as command
     line argument for n row.
     A AAA
     A AA
     AA
     A
13   Create circle class then derive cylinder class with overriding of area calculation
     method.
14   Create Tiles class with lengh and width parameter and area calculation methos.Derive
     subclass Room with same parameter and quantity function to calculate number of
     tiles required as per room size.
15   Write a program to find volume of Box. Overload constructor to initialize data
     member of Box. Derive class BoxWeight with weight data member and density
     calculation method.
16   Derive shipment class form above BoxWeight class with data member shipping price
     per unit weight and calculate method to find total shipping cost.
17   Create a StringBuffer object and illustrate the operation of the append() and reverse()
     methods.
18   Write an application that creates an array with five Float arguments and display the
     length of the array and its elements.
19   Write an application that accepts two doubles as its command-line arguments,
     multiplies these together, and display the product.
20   Write an application that converts between meters and feet.its first command-line
     argument is a number. Its second command-line argument if either “feet” or
     “meters”. If this argument equal “feet”, display a string reporting the equivalent
     number of meters. If this argument equal “meters”, display a string reporting the
     equivalent number of feet. Otherwise, report that the unit system is not recognized.
(note: one meter is equal to 3.28 feet.)
21 Write a program that outputs a table of numbers. Each line in the table contains three
   entries: the number, its square, and its cube. Begin with 1 and end with 10.
22 Use While loop to generate random numbers and maintain a running sum of these
   values. Terminate when the sum exceeds 20. (Note: use Math. random() method to
   obtain numbers.)
23 Write an application that generates the first 15 numbers in the Fibonacci series.
24 Write an application that counts the total number of characters in all of its command-
   line arguments.
25 Write an application that searches through its command-line argument. If an
   argument is found that does not begin with and upper case letter, display error
   message and terminate.
26 Write an application that declares a class named Sphere. It should have instance
   variables to record its radius and the coordinates of its center. This should be of type
   double. Use the new operator to create a Sphere object. Set and display its instance
   variables.
27 Write an application that defines a Circle class with two constructors. The first form
   accepts a double value that represents the radius of the circle. This constructor
   assumes that the circle is centered at the origin. The second form accepts the three
   double values. The first two arguments define the coordinates of the center and the
   third argument defines the radius.
28 Write an application that defines a sphere class with three constructors.
   The first form accepts no arguments. It assumes the sphere is centered at the origin
   and has a radius of one unit. The second form accepts one double value that
   represents the radius of the sphere. It assumes the sphere is centered at the origin .The
   third form accept four double arguments. These specify the coordinates of the center
   and the radius.
29 Write an application that demonstrates a class inheritance hierarchy. Class M extends
   Object and has two instance variable of type float and String. Class N extends M and
   has one instance variable of type Double. Instance class N initialize and display its
   variables.
30 Write a program that illustrates method overriding. Class Bond is extended by
   ConvertibleBond. Each of there classes defines a display() method that outputs the
   string “Bond” of “ConvertibleBond”, respectively. Declare an array to hold six Bond
   objects. Initialize the elements of the array with a mix of Bond and ConvertibleBond
   objects. Execute a program loop to invoke the display method of each object.
31 Write an application that illustrates how a method can invoke a superclass method.
   Class I2 is extended by J2.Class J2 is extended by K2.Each of these classes defines a
   getDescription() method that returns a string. That string includes a description of the
   class plus descriptions of each superclass. Instantiate each of these classes and invoke
   the getDescription() method.
32 Write a program that illustrates interface inheritance. Interface p is extended by P1
   and P2.Interface p12 inherits from both P1 and P2.Each interface declares one
   constant and one method. Class Q implements P12.Instatiate Q and invoke each of its
   methods. Each method Displays one of the constants.
33 Assume that you created three packages named a.b.c.d, j.k.l.m, and r.s.t. the .class
   files for these packages are stored in directories c:lab8abc, c:freshmanchem101j
   klm,and c:semeinarrst,respectively.How should CLASSPATH be set so the
   classes and interfaces in those three packages can be located by JDK tools.
34 Write a program that illustrates how to use the throw statement. Create a class that
has static method main(),a(),b(),c(), and d().The main method invokes a().Method a()
    invokes b().method b() invokes c().Method c() invokes d().Method d() declares a
    local array with ten elements and then attempts to access the element at position
    20.Therefor,and ArryIndexOutOfBound Exception is generated. Each method has a
    catch block for this type of exception and a finally block. The catch blocks in c() and
    d() contain a throw statement to propagate this exception to their caller .Use the
    println() method to monitor the flow of control in your program.

35 A method named average() has one argument that is an array of strings. It converts
   these to double values and returns their average. The method generates a
   NullPointerException if a array elements is null or NumberFormatException if an
   element is incorrectly formatted. Write a program that illustrates how to declare and
   use this method. Include throws clause in the method declaration to indicate that
   these problems can occur.
36 Write an application that reads a file and counts the number of occurrences of each
   digit between 0 and 9 .supply the file name as a command-line argument.
37 Write an application that reads and processes strings from the console. Reverse the
   sequence of characters in each string and then display it.
38 Write one application that writes the first 15 numbers of the Fibonacci series to a file.
   Use writeSort() method of DataOutputStrem to output the numbers. Write a second
   application that reads this data from a file and displays it. Use the readShort() method
   of DataInputStream to input the numbers. For both applications ,specify the name of
   the file a command-line argument.
39 Write an Applet which display one string named LDCE at the centre in red color.
40 Write an applet that draws a circle. The dimensions of the applet should be 500*300
   pixels. The circle should be centered in the applet and have radius of 100 pixels.(Use
   the drawOval() method of Graphics.)
41 Write an applet that draws a rectangle and display one string in the center of the
   rectangle with yellow color. Also fill rectangle with blue color. The dimension of
   applet should be 500*300 pixels.
42 Write an applet which insets an image.
43 Write an applet that tracks the position of the mouse when it is dragged or moved.
   Draw a 10 * 10 pixel rectangle filled with black at the current mouse position.
44 Write an applet that contains one button. Initialize the label on the button to “start”
   .when the user presses the button, change the label to “stop” .Toggle the button label
   between these two values each time the button is pressed.
45 Write an applet and frame program that tracks the position of the mouse when it is
   dragged or moved. Print “hello” at the current mouse position.
46 Write an applet that contains three check boxes and 30 * 30 pixel canvas. The three
   check boxes should be labeled “red” ,”Green” and “Blue” .The selections of the
   check boxes determine the color of the canvas. for example ,if the user selects both
   “Red” and “Blue” the canvas should be purple.(Hint: Use the setBackground() and
   repaint() ,methods to change the color of the canvas)
47 Write a java frame program when mouse pressed in frame area ,each time new button
   added to frame. Write same program with different layout and see output.
48 Write a java frame program when mouse pressed in frame area new window is
   opened.When close button is pressed only one window should be closed.
49 Write a java frame program which shows use of button, menu bar and menu item.
50 Write an applet that contains one choice element and a 30 * 30 pixel canvas. The
   items in the choice element should be “red”, ”Green” and “Blue”. The Choice
selection should determine the color of the canvas.
51 Write a program to display a random integer between 5 and 10 every three seconds.
52 Write a multithreaded program that simulates a set of grasshoppers jumping around
   in a box. Each grasshopper jumps to a different location every 2 to 12 seconds.
   Display the new location of a grasshopper after each of these jumps.
53 Write a multi thread java program to find factorial of a large number.

Mais conteúdo relacionado

Mais procurados

Sp 1418794917
Sp 1418794917Sp 1418794917
Sp 1418794917lakshmi r
 
Computer science sqp
Computer science sqpComputer science sqp
Computer science sqpB Bhuvanesh
 
C programming session 04
C programming session 04C programming session 04
C programming session 04Dushmanta Nath
 
R Programming: Introduction to Vectors
R Programming: Introduction to VectorsR Programming: Introduction to Vectors
R Programming: Introduction to VectorsRsquared Academy
 
C programming session 02
C programming session 02C programming session 02
C programming session 02Dushmanta Nath
 
Java conceptual learning material
Java conceptual learning materialJava conceptual learning material
Java conceptual learning materialArthyR3
 
Numerical analysis using Scilab: Numerical stability and conditioning
Numerical analysis using Scilab: Numerical stability and conditioningNumerical analysis using Scilab: Numerical stability and conditioning
Numerical analysis using Scilab: Numerical stability and conditioningScilab
 
Numerical analysis using Scilab: Error analysis and propagation
Numerical analysis using Scilab: Error analysis and propagationNumerical analysis using Scilab: Error analysis and propagation
Numerical analysis using Scilab: Error analysis and propagationScilab
 
Unit 2 c programming_basics
Unit 2 c programming_basicsUnit 2 c programming_basics
Unit 2 c programming_basicskirthika jeyenth
 
Numerical analysis using Scilab: Solving nonlinear equations
Numerical analysis using Scilab: Solving nonlinear equationsNumerical analysis using Scilab: Solving nonlinear equations
Numerical analysis using Scilab: Solving nonlinear equationsScilab
 
Unit 4 functions and pointers
Unit 4 functions and pointersUnit 4 functions and pointers
Unit 4 functions and pointerskirthika jeyenth
 

Mais procurados (20)

CP Handout#7
CP Handout#7CP Handout#7
CP Handout#7
 
Sp 1418794917
Sp 1418794917Sp 1418794917
Sp 1418794917
 
Computer science sqp
Computer science sqpComputer science sqp
Computer science sqp
 
C programming session 04
C programming session 04C programming session 04
C programming session 04
 
Intake 38 4
Intake 38 4Intake 38 4
Intake 38 4
 
R Programming: Introduction to Vectors
R Programming: Introduction to VectorsR Programming: Introduction to Vectors
R Programming: Introduction to Vectors
 
C programming session 02
C programming session 02C programming session 02
C programming session 02
 
Java conceptual learning material
Java conceptual learning materialJava conceptual learning material
Java conceptual learning material
 
Numerical analysis using Scilab: Numerical stability and conditioning
Numerical analysis using Scilab: Numerical stability and conditioningNumerical analysis using Scilab: Numerical stability and conditioning
Numerical analysis using Scilab: Numerical stability and conditioning
 
Intake 38 3
Intake 38 3Intake 38 3
Intake 38 3
 
Csharp generics
Csharp genericsCsharp generics
Csharp generics
 
Numerical analysis using Scilab: Error analysis and propagation
Numerical analysis using Scilab: Error analysis and propagationNumerical analysis using Scilab: Error analysis and propagation
Numerical analysis using Scilab: Error analysis and propagation
 
Hw1 a
Hw1 aHw1 a
Hw1 a
 
BPstudy sklearn 20180925
BPstudy sklearn 20180925BPstudy sklearn 20180925
BPstudy sklearn 20180925
 
Unit 2 c programming_basics
Unit 2 c programming_basicsUnit 2 c programming_basics
Unit 2 c programming_basics
 
Numerical analysis using Scilab: Solving nonlinear equations
Numerical analysis using Scilab: Solving nonlinear equationsNumerical analysis using Scilab: Solving nonlinear equations
Numerical analysis using Scilab: Solving nonlinear equations
 
Unit 4 functions and pointers
Unit 4 functions and pointersUnit 4 functions and pointers
Unit 4 functions and pointers
 
Unit 3 arrays and_string
Unit 3 arrays and_stringUnit 3 arrays and_string
Unit 3 arrays and_string
 
CP Handout#4
CP Handout#4CP Handout#4
CP Handout#4
 
Class 10
Class 10Class 10
Class 10
 

Destaque

List of programs for practical file
List of programs for practical fileList of programs for practical file
List of programs for practical fileswatisinghal
 
Bca sem 6 php practicals 1to12
Bca sem 6 php practicals 1to12Bca sem 6 php practicals 1to12
Bca sem 6 php practicals 1to12Hitesh Patel
 
Advanced Java - Praticals
Advanced Java - PraticalsAdvanced Java - Praticals
Advanced Java - PraticalsFahad Shaikh
 
Advanced java practical semester 6_computer science
Advanced java practical semester 6_computer scienceAdvanced java practical semester 6_computer science
Advanced java practical semester 6_computer scienceNiraj Bharambe
 
tybsc it asp.net full unit 1,2,3,4,5,6 notes
tybsc it asp.net full unit 1,2,3,4,5,6 notestybsc it asp.net full unit 1,2,3,4,5,6 notes
tybsc it asp.net full unit 1,2,3,4,5,6 notesWE-IT TUTORIALS
 
Advanced Java Practical File
Advanced Java Practical FileAdvanced Java Practical File
Advanced Java Practical FileSoumya Behera
 

Destaque (7)

List of programs for practical file
List of programs for practical fileList of programs for practical file
List of programs for practical file
 
Bca sem 6 php practicals 1to12
Bca sem 6 php practicals 1to12Bca sem 6 php practicals 1to12
Bca sem 6 php practicals 1to12
 
Advanced Java - Praticals
Advanced Java - PraticalsAdvanced Java - Praticals
Advanced Java - Praticals
 
Advanced java practical semester 6_computer science
Advanced java practical semester 6_computer scienceAdvanced java practical semester 6_computer science
Advanced java practical semester 6_computer science
 
tybsc it asp.net full unit 1,2,3,4,5,6 notes
tybsc it asp.net full unit 1,2,3,4,5,6 notestybsc it asp.net full unit 1,2,3,4,5,6 notes
tybsc it asp.net full unit 1,2,3,4,5,6 notes
 
Ad java prac sol set
Ad java prac sol setAd java prac sol set
Ad java prac sol set
 
Advanced Java Practical File
Advanced Java Practical FileAdvanced Java Practical File
Advanced Java Practical File
 

Semelhante a Practical java

Chapter 8Exercise1.Design an application that accept.docx
Chapter 8Exercise1.Design an application that accept.docxChapter 8Exercise1.Design an application that accept.docx
Chapter 8Exercise1.Design an application that accept.docxtiffanyd4
 
C_Lab Manual_Part A.docx
C_Lab Manual_Part A.docxC_Lab Manual_Part A.docx
C_Lab Manual_Part A.docxPandiya Rajan
 
C programming session 05
C programming session 05C programming session 05
C programming session 05Vivek Singh
 
Data Structure.pdf
Data Structure.pdfData Structure.pdf
Data Structure.pdfMemeMiner
 
Develop a system flowchart and then write a menu-driven C++ program .pdf
Develop a system flowchart and then write a menu-driven C++ program .pdfDevelop a system flowchart and then write a menu-driven C++ program .pdf
Develop a system flowchart and then write a menu-driven C++ program .pdfleventhalbrad49439
 
exercises_for_live_coding_Java_advanced-2.pdf
exercises_for_live_coding_Java_advanced-2.pdfexercises_for_live_coding_Java_advanced-2.pdf
exercises_for_live_coding_Java_advanced-2.pdfenodani2008
 
HSc Computer Science Practical Slip for Class 12
HSc Computer Science Practical Slip for Class 12HSc Computer Science Practical Slip for Class 12
HSc Computer Science Practical Slip for Class 12Aditi Bhushan
 
C programming exercises and solutions
C programming exercises and solutions C programming exercises and solutions
C programming exercises and solutions Rumman Ansari
 

Semelhante a Practical java (20)

Chapter 8Exercise1.Design an application that accept.docx
Chapter 8Exercise1.Design an application that accept.docxChapter 8Exercise1.Design an application that accept.docx
Chapter 8Exercise1.Design an application that accept.docx
 
Programming qns
Programming qnsProgramming qns
Programming qns
 
Lab exam question_paper
Lab exam question_paperLab exam question_paper
Lab exam question_paper
 
Assignment in java
Assignment in javaAssignment in java
Assignment in java
 
C_Lab Manual_Part A.docx
C_Lab Manual_Part A.docxC_Lab Manual_Part A.docx
C_Lab Manual_Part A.docx
 
C programming session 05
C programming session 05C programming session 05
C programming session 05
 
C++ Lab Maual.pdf
C++ Lab Maual.pdfC++ Lab Maual.pdf
C++ Lab Maual.pdf
 
C++ Lab Maual.pdf
C++ Lab Maual.pdfC++ Lab Maual.pdf
C++ Lab Maual.pdf
 
Data Structure.pdf
Data Structure.pdfData Structure.pdf
Data Structure.pdf
 
Java programlist (1)
Java programlist (1)Java programlist (1)
Java programlist (1)
 
Array sheet
Array sheet Array sheet
Array sheet
 
Develop a system flowchart and then write a menu-driven C++ program .pdf
Develop a system flowchart and then write a menu-driven C++ program .pdfDevelop a system flowchart and then write a menu-driven C++ program .pdf
Develop a system flowchart and then write a menu-driven C++ program .pdf
 
exercises_for_live_coding_Java_advanced-2.pdf
exercises_for_live_coding_Java_advanced-2.pdfexercises_for_live_coding_Java_advanced-2.pdf
exercises_for_live_coding_Java_advanced-2.pdf
 
HSc Computer Science Practical Slip for Class 12
HSc Computer Science Practical Slip for Class 12HSc Computer Science Practical Slip for Class 12
HSc Computer Science Practical Slip for Class 12
 
Java execise
Java execiseJava execise
Java execise
 
CS8391 Data Structures Part B Questions Anna University
CS8391 Data Structures Part B Questions Anna UniversityCS8391 Data Structures Part B Questions Anna University
CS8391 Data Structures Part B Questions Anna University
 
C programming exercises and solutions
C programming exercises and solutions C programming exercises and solutions
C programming exercises and solutions
 
A01
A01A01
A01
 
Sharbani bhattacharya VB Structures
Sharbani bhattacharya VB StructuresSharbani bhattacharya VB Structures
Sharbani bhattacharya VB Structures
 
Programming questions
Programming questionsProgramming questions
Programming questions
 

Último

Sports & Fitness Value Added Course FY..
Sports & Fitness Value Added Course FY..Sports & Fitness Value Added Course FY..
Sports & Fitness Value Added Course FY..Disha Kariya
 
Seal of Good Local Governance (SGLG) 2024Final.pptx
Seal of Good Local Governance (SGLG) 2024Final.pptxSeal of Good Local Governance (SGLG) 2024Final.pptx
Seal of Good Local Governance (SGLG) 2024Final.pptxnegromaestrong
 
Advanced Views - Calendar View in Odoo 17
Advanced Views - Calendar View in Odoo 17Advanced Views - Calendar View in Odoo 17
Advanced Views - Calendar View in Odoo 17Celine George
 
Web & Social Media Analytics Previous Year Question Paper.pdf
Web & Social Media Analytics Previous Year Question Paper.pdfWeb & Social Media Analytics Previous Year Question Paper.pdf
Web & Social Media Analytics Previous Year Question Paper.pdfJayanti Pande
 
Basic Civil Engineering first year Notes- Chapter 4 Building.pptx
Basic Civil Engineering first year Notes- Chapter 4 Building.pptxBasic Civil Engineering first year Notes- Chapter 4 Building.pptx
Basic Civil Engineering first year Notes- Chapter 4 Building.pptxDenish Jangid
 
Z Score,T Score, Percential Rank and Box Plot Graph
Z Score,T Score, Percential Rank and Box Plot GraphZ Score,T Score, Percential Rank and Box Plot Graph
Z Score,T Score, Percential Rank and Box Plot GraphThiyagu K
 
Nutritional Needs Presentation - HLTH 104
Nutritional Needs Presentation - HLTH 104Nutritional Needs Presentation - HLTH 104
Nutritional Needs Presentation - HLTH 104misteraugie
 
Paris 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activityParis 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activityGeoBlogs
 
Key note speaker Neum_Admir Softic_ENG.pdf
Key note speaker Neum_Admir Softic_ENG.pdfKey note speaker Neum_Admir Softic_ENG.pdf
Key note speaker Neum_Admir Softic_ENG.pdfAdmir Softic
 
1029-Danh muc Sach Giao Khoa khoi 6.pdf
1029-Danh muc Sach Giao Khoa khoi  6.pdf1029-Danh muc Sach Giao Khoa khoi  6.pdf
1029-Danh muc Sach Giao Khoa khoi 6.pdfQucHHunhnh
 
Application orientated numerical on hev.ppt
Application orientated numerical on hev.pptApplication orientated numerical on hev.ppt
Application orientated numerical on hev.pptRamjanShidvankar
 
Making and Justifying Mathematical Decisions.pdf
Making and Justifying Mathematical Decisions.pdfMaking and Justifying Mathematical Decisions.pdf
Making and Justifying Mathematical Decisions.pdfChris Hunter
 
fourth grading exam for kindergarten in writing
fourth grading exam for kindergarten in writingfourth grading exam for kindergarten in writing
fourth grading exam for kindergarten in writingTeacherCyreneCayanan
 
Holdier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdfHoldier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdfagholdier
 
Class 11th Physics NEET formula sheet pdf
Class 11th Physics NEET formula sheet pdfClass 11th Physics NEET formula sheet pdf
Class 11th Physics NEET formula sheet pdfAyushMahapatra5
 
Gardella_Mateo_IntellectualProperty.pdf.
Gardella_Mateo_IntellectualProperty.pdf.Gardella_Mateo_IntellectualProperty.pdf.
Gardella_Mateo_IntellectualProperty.pdf.MateoGardella
 
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...christianmathematics
 

Último (20)

Sports & Fitness Value Added Course FY..
Sports & Fitness Value Added Course FY..Sports & Fitness Value Added Course FY..
Sports & Fitness Value Added Course FY..
 
Seal of Good Local Governance (SGLG) 2024Final.pptx
Seal of Good Local Governance (SGLG) 2024Final.pptxSeal of Good Local Governance (SGLG) 2024Final.pptx
Seal of Good Local Governance (SGLG) 2024Final.pptx
 
Advanced Views - Calendar View in Odoo 17
Advanced Views - Calendar View in Odoo 17Advanced Views - Calendar View in Odoo 17
Advanced Views - Calendar View in Odoo 17
 
Web & Social Media Analytics Previous Year Question Paper.pdf
Web & Social Media Analytics Previous Year Question Paper.pdfWeb & Social Media Analytics Previous Year Question Paper.pdf
Web & Social Media Analytics Previous Year Question Paper.pdf
 
Basic Civil Engineering first year Notes- Chapter 4 Building.pptx
Basic Civil Engineering first year Notes- Chapter 4 Building.pptxBasic Civil Engineering first year Notes- Chapter 4 Building.pptx
Basic Civil Engineering first year Notes- Chapter 4 Building.pptx
 
Mattingly "AI & Prompt Design: Structured Data, Assistants, & RAG"
Mattingly "AI & Prompt Design: Structured Data, Assistants, & RAG"Mattingly "AI & Prompt Design: Structured Data, Assistants, & RAG"
Mattingly "AI & Prompt Design: Structured Data, Assistants, & RAG"
 
Z Score,T Score, Percential Rank and Box Plot Graph
Z Score,T Score, Percential Rank and Box Plot GraphZ Score,T Score, Percential Rank and Box Plot Graph
Z Score,T Score, Percential Rank and Box Plot Graph
 
Nutritional Needs Presentation - HLTH 104
Nutritional Needs Presentation - HLTH 104Nutritional Needs Presentation - HLTH 104
Nutritional Needs Presentation - HLTH 104
 
Paris 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activityParis 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activity
 
Key note speaker Neum_Admir Softic_ENG.pdf
Key note speaker Neum_Admir Softic_ENG.pdfKey note speaker Neum_Admir Softic_ENG.pdf
Key note speaker Neum_Admir Softic_ENG.pdf
 
1029-Danh muc Sach Giao Khoa khoi 6.pdf
1029-Danh muc Sach Giao Khoa khoi  6.pdf1029-Danh muc Sach Giao Khoa khoi  6.pdf
1029-Danh muc Sach Giao Khoa khoi 6.pdf
 
Application orientated numerical on hev.ppt
Application orientated numerical on hev.pptApplication orientated numerical on hev.ppt
Application orientated numerical on hev.ppt
 
Making and Justifying Mathematical Decisions.pdf
Making and Justifying Mathematical Decisions.pdfMaking and Justifying Mathematical Decisions.pdf
Making and Justifying Mathematical Decisions.pdf
 
Código Creativo y Arte de Software | Unidad 1
Código Creativo y Arte de Software | Unidad 1Código Creativo y Arte de Software | Unidad 1
Código Creativo y Arte de Software | Unidad 1
 
fourth grading exam for kindergarten in writing
fourth grading exam for kindergarten in writingfourth grading exam for kindergarten in writing
fourth grading exam for kindergarten in writing
 
Advance Mobile Application Development class 07
Advance Mobile Application Development class 07Advance Mobile Application Development class 07
Advance Mobile Application Development class 07
 
Holdier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdfHoldier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdf
 
Class 11th Physics NEET formula sheet pdf
Class 11th Physics NEET formula sheet pdfClass 11th Physics NEET formula sheet pdf
Class 11th Physics NEET formula sheet pdf
 
Gardella_Mateo_IntellectualProperty.pdf.
Gardella_Mateo_IntellectualProperty.pdf.Gardella_Mateo_IntellectualProperty.pdf.
Gardella_Mateo_IntellectualProperty.pdf.
 
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
 

Practical java

  • 1. L.D. College of Engineering SEM: 5th Information Technology Subject: JAVA Programming Practical List 1 Pass student name using command line argument and print output in following format: First Name : abc Second Name : pqr Last Name : str 2 Write a program that creates and initializes a four element byte array. Calculate and display the average of its values. 3. Write an application that creates a two-dimension arrary with int values. the first, second, and third elements should be arrays with one, two and three numbers respectively. Display the length of each dimension. 4 Write a program to check whether given number is even or odd. 5 Write a program that displays the value of 2 raised to the power 12. 6. Write a program that displays the substring formed by the last ten characters of a string.(Use length() method) 7 A string contains five numbers separated by commas .Write a program that displays the last number. 9 Write a program check primality of a number. 10 Write a program to create circle class with area function to find area of circle. 11 Define class complex with function to add and to compare to complex number. 12 Write a program to print following triangle with character ‘A’ passed as command line argument for n row. A AAA A AA AA A 13 Create circle class then derive cylinder class with overriding of area calculation method. 14 Create Tiles class with lengh and width parameter and area calculation methos.Derive subclass Room with same parameter and quantity function to calculate number of tiles required as per room size. 15 Write a program to find volume of Box. Overload constructor to initialize data member of Box. Derive class BoxWeight with weight data member and density calculation method. 16 Derive shipment class form above BoxWeight class with data member shipping price per unit weight and calculate method to find total shipping cost. 17 Create a StringBuffer object and illustrate the operation of the append() and reverse() methods. 18 Write an application that creates an array with five Float arguments and display the length of the array and its elements. 19 Write an application that accepts two doubles as its command-line arguments, multiplies these together, and display the product. 20 Write an application that converts between meters and feet.its first command-line argument is a number. Its second command-line argument if either “feet” or “meters”. If this argument equal “feet”, display a string reporting the equivalent number of meters. If this argument equal “meters”, display a string reporting the equivalent number of feet. Otherwise, report that the unit system is not recognized.
  • 2. (note: one meter is equal to 3.28 feet.) 21 Write a program that outputs a table of numbers. Each line in the table contains three entries: the number, its square, and its cube. Begin with 1 and end with 10. 22 Use While loop to generate random numbers and maintain a running sum of these values. Terminate when the sum exceeds 20. (Note: use Math. random() method to obtain numbers.) 23 Write an application that generates the first 15 numbers in the Fibonacci series. 24 Write an application that counts the total number of characters in all of its command- line arguments. 25 Write an application that searches through its command-line argument. If an argument is found that does not begin with and upper case letter, display error message and terminate. 26 Write an application that declares a class named Sphere. It should have instance variables to record its radius and the coordinates of its center. This should be of type double. Use the new operator to create a Sphere object. Set and display its instance variables. 27 Write an application that defines a Circle class with two constructors. The first form accepts a double value that represents the radius of the circle. This constructor assumes that the circle is centered at the origin. The second form accepts the three double values. The first two arguments define the coordinates of the center and the third argument defines the radius. 28 Write an application that defines a sphere class with three constructors. The first form accepts no arguments. It assumes the sphere is centered at the origin and has a radius of one unit. The second form accepts one double value that represents the radius of the sphere. It assumes the sphere is centered at the origin .The third form accept four double arguments. These specify the coordinates of the center and the radius. 29 Write an application that demonstrates a class inheritance hierarchy. Class M extends Object and has two instance variable of type float and String. Class N extends M and has one instance variable of type Double. Instance class N initialize and display its variables. 30 Write a program that illustrates method overriding. Class Bond is extended by ConvertibleBond. Each of there classes defines a display() method that outputs the string “Bond” of “ConvertibleBond”, respectively. Declare an array to hold six Bond objects. Initialize the elements of the array with a mix of Bond and ConvertibleBond objects. Execute a program loop to invoke the display method of each object. 31 Write an application that illustrates how a method can invoke a superclass method. Class I2 is extended by J2.Class J2 is extended by K2.Each of these classes defines a getDescription() method that returns a string. That string includes a description of the class plus descriptions of each superclass. Instantiate each of these classes and invoke the getDescription() method. 32 Write a program that illustrates interface inheritance. Interface p is extended by P1 and P2.Interface p12 inherits from both P1 and P2.Each interface declares one constant and one method. Class Q implements P12.Instatiate Q and invoke each of its methods. Each method Displays one of the constants. 33 Assume that you created three packages named a.b.c.d, j.k.l.m, and r.s.t. the .class files for these packages are stored in directories c:lab8abc, c:freshmanchem101j klm,and c:semeinarrst,respectively.How should CLASSPATH be set so the classes and interfaces in those three packages can be located by JDK tools. 34 Write a program that illustrates how to use the throw statement. Create a class that
  • 3. has static method main(),a(),b(),c(), and d().The main method invokes a().Method a() invokes b().method b() invokes c().Method c() invokes d().Method d() declares a local array with ten elements and then attempts to access the element at position 20.Therefor,and ArryIndexOutOfBound Exception is generated. Each method has a catch block for this type of exception and a finally block. The catch blocks in c() and d() contain a throw statement to propagate this exception to their caller .Use the println() method to monitor the flow of control in your program. 35 A method named average() has one argument that is an array of strings. It converts these to double values and returns their average. The method generates a NullPointerException if a array elements is null or NumberFormatException if an element is incorrectly formatted. Write a program that illustrates how to declare and use this method. Include throws clause in the method declaration to indicate that these problems can occur. 36 Write an application that reads a file and counts the number of occurrences of each digit between 0 and 9 .supply the file name as a command-line argument. 37 Write an application that reads and processes strings from the console. Reverse the sequence of characters in each string and then display it. 38 Write one application that writes the first 15 numbers of the Fibonacci series to a file. Use writeSort() method of DataOutputStrem to output the numbers. Write a second application that reads this data from a file and displays it. Use the readShort() method of DataInputStream to input the numbers. For both applications ,specify the name of the file a command-line argument. 39 Write an Applet which display one string named LDCE at the centre in red color. 40 Write an applet that draws a circle. The dimensions of the applet should be 500*300 pixels. The circle should be centered in the applet and have radius of 100 pixels.(Use the drawOval() method of Graphics.) 41 Write an applet that draws a rectangle and display one string in the center of the rectangle with yellow color. Also fill rectangle with blue color. The dimension of applet should be 500*300 pixels. 42 Write an applet which insets an image. 43 Write an applet that tracks the position of the mouse when it is dragged or moved. Draw a 10 * 10 pixel rectangle filled with black at the current mouse position. 44 Write an applet that contains one button. Initialize the label on the button to “start” .when the user presses the button, change the label to “stop” .Toggle the button label between these two values each time the button is pressed. 45 Write an applet and frame program that tracks the position of the mouse when it is dragged or moved. Print “hello” at the current mouse position. 46 Write an applet that contains three check boxes and 30 * 30 pixel canvas. The three check boxes should be labeled “red” ,”Green” and “Blue” .The selections of the check boxes determine the color of the canvas. for example ,if the user selects both “Red” and “Blue” the canvas should be purple.(Hint: Use the setBackground() and repaint() ,methods to change the color of the canvas) 47 Write a java frame program when mouse pressed in frame area ,each time new button added to frame. Write same program with different layout and see output. 48 Write a java frame program when mouse pressed in frame area new window is opened.When close button is pressed only one window should be closed. 49 Write a java frame program which shows use of button, menu bar and menu item. 50 Write an applet that contains one choice element and a 30 * 30 pixel canvas. The items in the choice element should be “red”, ”Green” and “Blue”. The Choice
  • 4. selection should determine the color of the canvas. 51 Write a program to display a random integer between 5 and 10 every three seconds. 52 Write a multithreaded program that simulates a set of grasshoppers jumping around in a box. Each grasshopper jumps to a different location every 2 to 12 seconds. Display the new location of a grasshopper after each of these jumps. 53 Write a multi thread java program to find factorial of a large number.