0

hi everyone,

iam an IT student that tried to solve this java programming question but have many problems can anyone help me with it ?? here is the assignment ....

using java programming language, write a program that will read a java code and locate all the assignment statements.from each of these statments you will extract the variables getting a value(the one before the = operator), and all of the variables in the expression at the right-hand side.you may assume that no variable contains an embeded blank,and that each atatement is on a line by itself .

thanx all,
Mayy

4
Contributors
4
Replies
5
Views
11 Years
Discussion Span
Last Post by ~s.o.s~
0

yes iam allowed to use the simplest expressions,thx for replying

0

You should use the Scanner class to parse each line of the file. Then use the functionalities of the String class to separate the variables and values.

0

Use BufferedReader (1.4) class to read in each line of the file as a string and for each line, locate the position of the '=' character. Use the substring function to extract the left and right parts of the string based on the position you have got. Skip the lines which don't contain an '=' character.

This is as simple as it gets although you might need to throw in a bit of additional logic depending on the kind of output you need.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.