You can learn Java with me as the Java Programming language is being made easily. It would take a period of minimum three months and maximum 6 months to master Java. I would recommend you to watch all my videos to crack any software interviews that would require Java Programming language as a primary skill.
Properties:-
===========
1. Properties class is a child class to Hashtable.
2. It was introduced in JDK1.0 version.
3. It is a Legacy class.
4. Please be informed that properties file is like a text file with the .properties extension and you can use the properties class to transport the data from Java application to the plain text file. And, every data has to be represented in the form of Key-value pair.
5. If we have any data that needs to be changed frequently in the Java application, we use a file called properties file and a communication is already established between these properties file and the Java Application. So that we can avoid re-compilation every time.
6. Please be informed that the GUI labels in the GUI applications will use properties file as the data or the information keeps changing dynamically.
7. To manage validations messages in the data validations in any application we will use properties file.
8. Internationalization.
Please be informed that to manage local messages, we will also use Properties file.
9. User Defined exception:-
To manage any user Defined exceptions or to achieve Exceptional handling, we will use properties file.
Operations to perform to handle data by using properties file:-
=============================================================
1. You can write some data to the properties file from the Java application.
2. You can read some data from the properties file to the Java application.
1. You can write some data to the properties file from the Java application.
=============================================================================
1. Create FileOutPutStreamwriter with the targeted properties file.
FileOutputStream fos=new FileOutputStream("D:\\test\\abcd.properties");
2. Create properties class object and set the 'key-value' pair data in the form of Object.
Properties p=new Properties();
p.setProperty("India", "New Delhi");
p.setProperty("USA", "Washington DC");
p.setProperty("Russia", "Moscow");
p.setProperty("India", "The Greater New Delhi");
3.Store Properties object data in the File by using the store method.
p.store(fos, "ANY MEANINGFUL STRING MESSAGE");
========To be Continued============
Негізгі бет Collection Framework in Java- how to write data to the properties file using properties class?
Пікірлер: 1