Can I edit a .Java file?

-1

I need to modify some variables to start a program, these variables are constant during the start of the program I want to start, but at the request of the user can be modified, these variables I have within a file .java but the doubt.

Can I edit a file .java and how can I edit a file .PROPERTIES or .Txt ?

    
asked by Dacoso 31.10.2016 в 17:05
source

2 answers

5

Yes, the .java file can be modified as you modify any .txt file.

But there are two options, if you read it directly from your program with a FileReader there is no problem, but if you want to use it as part of the program you must compile it in a .class.

    
answered by 31.10.2016 / 17:10
source
1

The 3 types of files you mention:

.java 
.properties 
.txt

you can edit them with a plain text processor without problem.

I think that what you want is to modify variables within a .java file

  

I need to modify some variables to start a program,   these variables are constant during the start of the program that   I want to start,

If what you have is constant and you want to modify it then you should not define them as constants.

If at the start of the program you want to modify some variables these could only be defined with the public modifier and the values are regularly downloaded or obtained from a configuration file, .txt, .json. xml etc.

    
answered by 31.10.2016 в 18:05