5 ways to create an object in java java Core Java by devs5003 - May 14, 2020June 3, 20223 As we know that creation of an object in java is a cost-effective affair. Therefore we should have knowledge of different ways to create Objects in java so that we can use a particular way in the given scenario to handle the situation in a better way. Here we will find out 5 ways to create an object in Java. Using new keyword : This way of creating object in Java is the most common way in all. Using newInstance() method of class 'Class' : You must be aware of the Reflection API in Java. However, under reflection API we have these classes 'Class' & 'Constructor'. Moreover, both classes have newInstance() method in it to create objects in Java. Therefore, we will see newInstance()
7 ways to print elements of a Collection in Java java Core Java by devs5003 - May 14, 2020November 25, 20250 In this article, we are going to learn 7 ways to print elements of a Collection in Java. However, I am sure that any java programmer will come across this situation multiple times while writing programs to develop any application/software. Especially while testing the program, printing of elements on console becomes a bit mandatory. Sometimes, it becomes confusing that which way we should choose to print the values of elements of the defined collection as per our requirement. I hope you will be able to tackle all the scenarios after going through this article accordingly. However, we will go step by step to get a hold on this topic. Let's consider a List as a Collection to demonstrate all the ways
How to run a Java program in Windows 10+ ? Core Java java by devs5003 - April 28, 2020January 17, 20257 An essential target as a new learner of a programming language is running your first program. Java is a popular and flexible programming language known for its portability and wide range of applications. To run a Java program, we need to set up our development environment, write the code, and then execute it. In this article ''How to run a Java program in Windows 10+ ?'', we are going to discuss a summary of the complete steps involved in running our very first Java program. If you are going to learn/work on Java, your first step is to install java on your computer/laptop and check whether you have complete environment to start running your Java Programs or not. Here, we