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 5 PERFORM STRING OPERATIONS USING ARRAYLIST

EX NO: 5 PROGRAM TO PERFORM STRING OPERATIONS USING ARRAYLIST

AIM.
To write a java program to perform string operations using ArrayList for the following
functions
a. Append - add at end
b. Insert – add at particular index
c. Search
d. List all string starts with given letter.


PROCEDURE.
1.Create the class arraylistexample. Create the object for the arraylist class.
2.Display the options to the user for performing string handling .
3.Use the function add() to append the string at the end and to insert the string at the particular index.
4. The function sort () is used to sort the elements in the array list.
5. The function indexof() is used to search whether the element is in the array list or not.
6.The function startsWith () is used to find whether the element starts with the specified character.
7.The function remove() is used to remove the element from the arraylist.
8.The function size() is used to determine the number of elements in the array list.

Git stats


    Comments

    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