Jump to content

listar numero de linhas


benkas

Recommended Posts

ois!!!

Alguem sabe como se lista as palavras de 1ficheiro e as respectivas linhas?Tipo:

Dados os ficheiros IntCell.java e TestCell.java  a linha de comando

$ java Identificadores TestIntCell.java IntCell.java

deve produzir o seguinte resultado:

IntCell.java

IntCell: 5, 11, 18

initialValue: 18-19

read: 25

storedvalue: 19, 26, 33, 35

write: 31

x: 33

TestIntCell.java

IntCell: 6

String: 4

System: 9

TestIntCell: 2

args: 4

m: 6, 8-9

out: 9

println: 9

read: 9

write: 8

Link to comment
Share on other sites

Simples lês linha a linha fazes um split por espaços para separar as palavras e depois é ver que palavras lá estão e guardar o numero da linha, para isso pode criar um Java Bean tipo Palavra em que leva a palavra e um vector com os números das linhas em que essa palavra aparece.

I haven’t lost my mind; it’s backed up on DVD somewhere!

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

By using this site you accept our Terms of Use and Privacy Policy. We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.