how to use StringTokenizer to retrieve the class name, attributes name and methods name from the Java Source Code

how to use StringTokenizer to retrieve the class name, attributes name and methods name from the Java Source Code

hi, I have done a program whereby it can read a Java file and then tokenize them into tokens. However, I am facing one problem which is retrieve the Class Name, Attributes Name and Methods Names only from the source code. Can anyone help me to solve it? Below are my portion of codes. Thx!

import java.util.*;
import java.io.*;

public class Abc {
  private String filename;
  private int count;

  Abc( String name ) {
     filename = name; 
     count = 0;
  }
   public void readFile() throws IOException{
     String line;
     System.out.println( "File: " + filename ); 

     Scanner sc = new Scanner( new File ( filename )  );
     while (sc.hasNextLine() ) {
        line = sc.nextLine();       
        count++;    
        tokenize(line);
     }
   }


  public void tokenize(String line) throws IOException {

    StringTokenizer st = new StringTokenizer( line, "; "  );
         while (st.hasMoreTokens()) {


        System.out.println("This is a token <" + st.nextToken() + ">");

     }
  }

  public static void main (String args [])throws Exception{
    Abc x; 
    x = new Abc ( "Abc.java" ); 
    x.readFile();
  }
}
View Answers









Related Tutorials/Questions & Answers:
how to use StringTokenizer to retrieve the class name, attributes name and methods name from the Java Source Code
how to use StringTokenizer to retrieve the class name, attributes name and methods name from the Java Source Code  hi, I have done a program whereby... one problem which is retrieve the Class Name, Attributes Name and Methods Names
Java class name and file name are different
Java class name and file name are different  Can we run a Java program having class name and file name different?   Hi Friend, No, you can't. It is necessary to save the java file with its class name otherwise
Advertisements
class name
class name  what is the class name of circle.java   how do i complie my jdk file, what happen s if i put in the correct commands and it still does not complie, what do i do next
class name
class name  how to create a class named box thaT INCLUDES integer data fields for length,width,and height, include three contructors that require one,two,three arguments
Name
all the human names which starts from B.   Java show all names that starts with particular character The give code takes the input character from...Name  make a program that take a input from user in alphabet and show
java how to get domain name from url
java how to get domain name from url  How to get the domain name from a url string? Example program in java for "how to get domain name from url" Thanks   Hi, You can use the following example code: URL linkURL
Difference between class,name,id attributes in each JSP tag
Difference between class,name,id attributes in each JSP tag  Can i know the difference between class,name,id attributes in each JSP tags.................. These 3 are only used for reference ..... And what are the differernces
How to extract name,surname, doamin name from mailid
How to extract name,surname, doamin name from mailid  Hi sir How to extract name,surname, doamin name from mailid using java coding? for example... name as java plz tel me
Get computer name in java
Get computer name in java       We can get the computer name by the java code program. For getting computer name we have used java.net.InetAddress class. We will use static
Retrieving the class name through Reflection API
Retrieving the class name through Reflection API       A more generic way, how to retrieve the name... the reference of the class java.util.Integer.class to it. Now retrieve the class name
How to get month name from date(like-25/06/2012) using java?
How to get month name from date(like-25/06/2012) using java?  How to get month name from date(like-25/06/2012) using java
retrieve Dept Name from table dept and retrieve list of employee from emp table for that dept in combobox
retrieve Dept Name from table dept and retrieve list of employee from emp table... 10 in Dept Number Textbox and onblur event,it should retrieve Dept Name from... retrieve data from database from table1 and display it in another textbox and from
How to retrieve file name and path of an excel spreadsheet imported into Oracle Database
How to retrieve file name and path of an excel spreadsheet imported into Oracle... Oracle database and I want to know how to retrieve the path of the file... of the spreadsheets imported (so I would know the location of the original source file
why java file save as its class name
why java file save as its class name  hi,this is subbareddy vajrala.my doubt is why java files save as its class names
how to get selected name from combo box
how to get selected name from combo box   i have fetched all records of worker i.e worker name. on a test.jsp and dispayed it into combo box ...my... of worker name within d combo box and display that id into a text box. plz
how to get selected name from combo box
how to get selected name from combo box   i have fetched all records of worker i.e worker name. on a test.jsp and dispayed it into combo box ...my... of worker name within d combo box and display that id into a text box. plz
how to get selected name from combo box
how to get selected name from combo box  i have fetched all records of worker i.e worker name. on a test.jsp and dispayed it into combo box ...my... of worker name within d combo box and display that id into a text box. plz answer
how to get selected name from combo box
how to get selected name from combo box  i have fetched all records of worker i.e worker name. on a test.jsp and dispayed it into combo box ...my... of worker name within d combo box and display that id into a text box. plz answer
how to get selected name from combo box
how to get selected name from combo box  i have fetched all records of worker i.e worker name. on a test.jsp and dispayed it into combo box ...my... of worker name within d combo box and display that id into a text box. plz answer
Get Class Name
Get Class Name       In the example given below we will learn how to get name of the particular class with package name. getName() method returns fully qualified name
Java example to get Object class name at runtime
Object's Class name =>RoseIndia Download Source Code... Java example to get Object class name at runtime       java get Object class name In java
how to get java path name
How to write script in Java  <html> <head> <script>alert('ok')</script> </head> </Html>
Java Program MY NAME
Java Program MY NAME   Write a class that displays your first name...() { }, Then, method main should create an object of your class, then call the methods... should have the lines of code needed to display that letter in a method
Java program to get class name without package
Java program to get class name without package ... example which describes you that how you can get the class name without package.... As a result we will finally get the class name without package.  In this code
personal name aliase from the web
personal name aliase from the web  enter the name to search result in internet connection
How to get the Day name
How to get the Day name  Hi, I am a beginner in Java and new to this web world as well. have a requirement to implement in my assignment project as below: We need to add the days in input date such that it create the date
timezone_name_from_abbr
timezone_name_from_abbr() Function PHP timezone_name_from_abbr function returns the timezone name from abbreviation. It returns timezone name on success or False on failure. Syntax of timezone_name_from_abbr() Function PHP timezone
My name, java project
My name, java project  Write a class that displays your first name... letter being displayed should have the lines of code needed to display that letter in a method with the following name (for example, for letter A, public
My name, java project
My name, java project  Write a class that displays your first name... letter being displayed should have the lines of code needed to display that letter in a method with the following name (for example, for letter A, public
Java Get Host Name
Java Get Host Name       In this Example you will learn how to get host name in Java... Name in Java?": Java code to get host nameADS_TO_REPLACE_2
How to search the table name in MS SQL Database 2005 from application
How to search the table name in MS SQL Database 2005 from application  How to search the table name in MS SQL Database 2005 from application from our helpdesk application? application might be in html
Find Month name using DateFormatSymbols class.
Find Month name using DateFormatSymbols class. In this tutorial, you will learn how to find the month name using DateFormatSymbols class. The class... DateFormat and SimpleDateFormar use DateFormatSymbols class to encapsulate
Hibernate 5 FrontBase Dialect class name
Hibernate 5 FrontBase Dialect class name  Hello, Tell me the Hibernate 5 FrontBase Dialect class name. Thanks   Class is: org.hibernate.dialect.FrontBase Hibernateconfiguration xml code: <property name
Hibernate 5 FrontBase Dialect class name
Hibernate 5 FrontBase Dialect class name  Hello, Tell me the Hibernate 5 FrontBase Dialect class name. Thanks   Class is: org.hibernate.dialect.FrontBase Hibernateconfiguration xml code: <property name
Hibernate 5 FrontBase Dialect class name
Hibernate 5 FrontBase Dialect class name  Hello, Tell me the Hibernate 5 FrontBase Dialect class name. Thanks   Class is: org.hibernate.dialect.FrontBase Hibernateconfiguration xml code: <property name
Hibernate 5 FrontBase Dialect class name
Hibernate 5 FrontBase Dialect class name  Hello, Tell me the Hibernate 5 FrontBase Dialect class name. Thanks   Class is: org.hibernate.dialect.FrontBase Hibernateconfiguration xml code: <property name
Name me Hibernate 5 H2 Dialect class
Name me Hibernate 5 H2 Dialect class  Hi, What is the name of Hibernate 5 H2 Dialect class file? Thanks   HI, Class name is: org.hibernate.dialect.H2 Following code should be added hibernate config file: <
Name me Hibernate 5 H2 Dialect class
Name me Hibernate 5 H2 Dialect class  Hi, What is the name of Hibernate 5 H2 Dialect class file? Thanks   HI, Class name is: org.hibernate.dialect.H2 Following code should be added hibernate config file: <
Name me Hibernate 5 H2 Dialect class
Name me Hibernate 5 H2 Dialect class  Hi, What is the name of Hibernate 5 H2 Dialect class file? Thanks   HI, Class name is: org.hibernate.dialect.H2 Following code should be added hibernate config file: <
Name me Hibernate 5 H2 Dialect class
Name me Hibernate 5 H2 Dialect class  Hi, What is the name of Hibernate 5 H2 Dialect class file? Thanks   HI, Class name is: org.hibernate.dialect.H2 Following code should be added hibernate config file: <
Get Property by Name
by Name       In this Tutorial we want to describe you a code that helps you in understanding to get Property by Name. For this we have a class name "Get Property
How to find a servlet object by name?
How to find a servlet object by name?  How can we locate a servlet object in the code by it's object name?   A. In web.xml you map servlet... the reference to another Servlet that Servlet's methods can be called
To retrieve the IP address from Host Name, vice-versac
To retrieve the IP address from Host Name, vice-versa... to explain the method to find out the IP address from host name and to vice verse. Here... the host name of that Host. Apart from all of this we put the condition for wrong
Java file get name
Java file get name In this section, you will learn how to get the name... the name of the file.ADS_TO_REPLACE_1 Here is the code: import java.io.... class, you can get the name of any file. Output:ADS_TO_REPLACE_2
search for a name
search for a name  Search for a name Write a program to accept an array of names and a name and check whether the name is present in the array. Return the count of occurrence. Use the following array as input {?Dave?, ?Ann
Name unique
Name unique  I want to check whether the value which I give for the name textfield already exists in the database. In case if it exists , it should.... In other words, value for the name should be unique
What is domain name and how to get it?
What is domain name and how to get it?  Hi, I am am searching for the information about the domain name. How to get a domain name for my company... is the unique name given to a website on a server. Example of domain name
Array Name
Array Name  How To Set Value in Two-Dimension ArrayList
CORE JAVA get middle name
CORE JAVA get middle name  hello sir...how to get middle name using...; The given code accepts the name from the console and find the middle character from the name. import java.util.*; class GetMiddleCharacter { public
Automatic Discovery of Personal Name Aliases from the Web
Automatic Discovery of Personal Name Aliases from the Web  i want code for snippet extraction in web

Ads