Programming Articles - Page 2617 of 3363

How to compile & run a Java program using Command Prompt?

Shriansh Kumar
Updated on 24-Apr-2025 18:17:52

19K+ Views

Command prompt is a command line interface that accepts text-based inputs or commands and performs tasks based on those command. Nowadays, there are various integrated development environments (IDEs) that are available to compile, build, and run Java programs within their environment. However, we can also compile and run Java programs using the Command Prompt. Compiling and Running Java Programs using CLI To compile and run Java programs outside the IDEs using the Command Prompt, we need to install the JDK and set its path in our system. To set up the development environment for Java on your local machine, we ... Read More

What are the different steps involved to execute a Java program?

Shriansh Kumar
Updated on 16-May-2025 19:05:14

3K+ Views

Java is an object-oriented programming language that provides various features like platform independence, security, garbage collection, etc. Unlike other programming languages, programs written in Java go through a specific sequence of steps during the compilation and execution process. Java follows the same process no matter where and how you compile and execute Java programs, whether using an IDE or the Command Prompt. In this article, we will discuss and understand the steps Java follows to execute programs. Compilation and Execution Process of Java Program Java program execution follows 5 major steps, which are as follows: Step 1: Edit or ... Read More

Scope and lifetime of variables in Java?

raja
Updated on 06-Feb-2020 09:24:32

10K+ Views

Instance VariablesA variable which is declared inside a class and outside all the methods and blocks is an instance variable. The general scope of an instance variable is throughout the class except in static methods. The lifetime of an instance variable is until the object stays in memory.Class VariablesA variable which is declared inside a class, outside all the blocks and is marked static is known as a class variable. The general scope of a class variable is throughout the class and the lifetime of a class variable is until the end of the program or as long as the ... Read More

What is JSON.parse() and and explain its use in javascript?

vineeth.mariserla
Updated on 30-Jul-2019 22:30:26

220 Views

JSON.parse()When the data is received from web server, the data is always a string .So to change it to the object, JSON.parse() method is used. Example Live Demo    var obj = '{"name":"Jon", "age":20, "city":"Columbia"}';    var res = JSON.parse(obj);    document.write(res);   console.log(res); output[object object] {"name":"Jon", "age":"20", "city":"Columbia"}

What is JSON.stringify() and explain its use in javascript?

vineeth.mariserla
Updated on 30-Jul-2019 22:30:26

251 Views

JSON.stringify()If we need to send data to a web server the data should be a string.To change the object literal to string JSON.stringify() method should be used.For instanceExample-1 Live Demo var obj = {name:"rekha", age:40, city:"newyork"}; var myJSON = JSON.stringify(obj); document.getElementById("demo").innerHTML = myJSON; Output{"name":"rekha","age":40,"city":"newyork"}Example-2 Live Demo    var obj = {"name":"ramesh","age":30,"family":           [{"mother":"geetha","father":"rao"}],"city":"berlin"};    var myJSON = JSON.stringify(obj);    document.getElementById("demo").innerHTML = myJSON; Output{"name":"ramesh","age":30,"family":[{"mother":"geetha","father":"rao"}],"city":"berlin"}

What is an object in JavaScript and access any property ?**

vineeth.mariserla
Updated on 30-Jul-2019 22:30:26

151 Views

Accessing Property Of An ObjectWithout objects there is no JavaScript. Everything such as boolean,numbers,functions etc are all objects.Accessing properties of an object is explained in the following method.Example-1 Live Demo    myObj = {"name":"Ramesh","age":30,"family":            [{"mother":"Geetha","father":"Rao"}],"city":"Berlin"};            var res = myObj.family[0].mother;   document.write(res); OutputGeethaExample-2 Live Demo    myObj = {"name":"Ramesh","age":30,"family":            [{"mother":"Geetha","father":"Rao"}],"city":"Berlin"};    var res = myObj.city;    document.write(res); OutputBerlin

How to set Temporary and Permanent Paths in Java?

raja
Updated on 11-Feb-2020 07:39:28

22K+ Views

There are two ways to set the path in java, First is Temporary Path and second is Permanent Path.Setting Temporary PathOpen command prompt in WindowsCopy the path of jdk/bin directory where java located (C:\Program Files\Java\jdk_version\bin)Write in the command prompt: SET PATH=C:\Program Files\Java\jdk_version\bin and hit enter command.Setting Permanent PathGo to My Computer ---> Right Click on it ---> Advanced System Settings ---> Advanced Tab ---> Click on Environment VariablesClick on New tab of User variables, assign value JAVA_HOME to Variable Namejava\jdk_version\bin path (copied path) to Variable Value and click on OK ButtonFinally, click on OK button.Read More

How to find the minimum value of an array in JavaScript?

vineeth.mariserla
Updated on 30-Jul-2019 22:30:26

3K+ Views

We can find the minimum value of an array using Math.min() and sort()1) Math.min() Math.min() function usually takes all the elements in an array and scrutinize each and every value to get the minimum value.It's methodology is discussed in the below example. Live DemoExample    function minimum(value) {       if (toString.call(value) !== "[object Array]")       return false;       return Math.min.apply(null, value);    }    document.write(minimum([6, 39, 55, 1, 44])); Output12)  sort()Using sort() and compare functions we can write the elements in ascending or descending order, later on using length property we can ... Read More

How to find the maximum value of an array in JavaScript?

vineeth.mariserla
Updated on 30-Jul-2019 22:30:26

1K+ Views

we can find the Maximum value of an array using Math.max() and sort() functions.1) Math.max()Math.max() function usually takes all the elements in an array and scrutinize each and every value to get the maximum value.It's methodology is discussed in the below example. Live DemoExample    function maximum(value) { if (toString.call(value) !== "[object Array]") return false; return Math.max.apply(null, value); } document.write(maximum([6, 39, 55, 1, 44])); Output55.2) sort()Using sort and compare functions we can ... Read More

what are the differences between unshift() and push() methods in javascript?

vineeth.mariserla
Updated on 30-Jul-2019 22:30:26

1K+ Views

Both the methods are used to  add elements to the array.But the only difference is unshift() method adds the element at the start of the array whereas push() adds the element at the end of the array.1) push()Array.push() method is used to add an element at the end of an array like a queue .In the following example it is shown how to add an element using push() method Live DemoExample var cars = ["Benz", "Lamborghini", "Tata safari"]; cars.push("Ferrari"); document.write(cars); OutputBenz, Lamborghini, Tata safari, Ferrari2)  unshift()Array.unshift() method is ... Read More

Advertisements