Posts

Showing posts from November, 2020

EXP 8 PROGRAM FOR DISPLAYING FILE INFORMATION

  EX NO :8  PROGRAM FOR DISPLAYING FILE INFORMATION  AIM    To write a java program that reads a file name from the user, displays information about whether  the file exists, whether the file is readable, or writable, the type of file and the length of the file in bytes.   PROCEDURE    1. Create a class filedemo. Get the file name from the user .   2. Use the file functions and display the information about the file.   3. getName() displays the name of the file.   4. getPath() diplays the path name of the file.   5. getParent() -This method returns the pathname string of this abstract pathname’s parent, or null  if this pathname does not name a parent directory.   6. exists() – Checks whether the file exists or not.   7. canRead()-This method is basically a check if the file can be read.   8. canWrite()-verifies whether the application can write to the file. ...

EXP 8 PROGRAM FOR DISPLAYING FILE INFORMATION

  EX NO :8  PROGRAM FOR DISPLAYING FILE INFORMATION  AIM    To write a java program that reads a file name from the user, displays information about whether  the file exists, whether the file is readable, or writable, the type of file and the length of the file in bytes.   PROCEDURE    1. Create a class filedemo. Get the file name from the user .   2. Use the file functions and display the information about the file.   3. getName() displays the name of the file.   4. getPath() diplays the path name of the file.   5. getParent() -This method returns the pathname string of this abstract pathname’s parent, or null  if this pathname does not name a parent directory.   6. exists() – Checks whether the file exists or not.   7. canRead()-This method is basically a check if the file can be read.   8. canWrite()-verifies whether the application can write to the file. ...

EXP 7 PROGRAM TO IMPLEMENT USER DEFINED EXCEPTION HANDLING

  EX NO : 7  PROGRAM TO IMPLEMENT USER DEFINED EXCEPTION HANDLING  AIM  To write a java program to implement user defined exception handling.  PROCEDURE  1.Create a class which extends Exception class.  2.Create a constructor which receives the string as argument.  3.Get the Amount as input from the user.  4.If the amount is negative, the exception will be generated.  5.Using the exception handling mechanism, the thrown exception is handled by the catch construct. 6.After the exception is handled, the string “invalid amount“ will be displayed. 7.If the amount is greater than 0, the message “Amount Deposited “ will be displayed   For Code (Click Here)

EXP 6 PROGRAM TO CALCULATE AREA USING ABSTRACT CLASS

EX NO : 6.  PROGRAM TO CALCULATE AREA USING ABSTRACT CLASS . AIM. To write a java program to calculate the area of rectangle, circle and triangle using the concept of  abstract class.  PROCEDURE  1. Create an abstract class named shape that contains two integers and an empty method named printarea().  2. Provide three classes named rectangle, triangle & circle such that each one of the classes  extends the class Shape.  3.Each of the inherited class from shape class should provide the implementation for the method  printarea().  4.Get the input and calculate the area of rectangle,circle and triangle .  5. In the shapeclass , create the objects for the three inherited classes and invoke the methods and  display the area values of the different shapes.  For Code (Click Here)

Popular posts from this blog

EXP 3 PROGRAM TO GENERATE PAYSLIP USING INHERITANCE

EXP 1 JAVA PROGRAM TO GENERATE ELECTRICITY BILL

EXP 2 PROGRAM TO IMPLEMENT CURRENCY CONVERTER, DISTANCE CONVERTER AND TIME CONVERTER USING PACKAGES