Jump to content
Sign in to follow this  
ansarise

Java - How identify and print a class name in java file received as input

Recommended Posts

Create java program to read java file and find the number of classes, number of methods in each class and also i want to print the number of lines in each class separately. Print Total number lines in the input Java file also...

Share this post


Link to post
Share on other sites
String fileContents = null;File file = new File("javafile.java");FileInputReader fis = new FileInputReader(file);BufferedInputStream bis = new BufferedInputStream(fis);DataInputStream dis = new DataInputStream(bis);while(dis.available() != 0)   fileContents += dis.readLine();

This is how you can read a file. How you decide to parse the information is up to your algorithm.

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
Sign in to follow this  

×
×
  • Create New...