Found 272 Articles for Java8

How to set CLASSPATH variable for JDK?

Alankritha Ammu
Updated on 13-Jun-2020 12:40:13

527 Views

Assuming you have stored your Java programs in c:\myprograms\ directory −Right-click on 'My Computer' and select 'Properties'.Click the 'Environment variables' button under the 'Advanced' tab.Now, add the 'CLASSPath' variable and set the path to the c:\myprograms\'.

What is JAVA_HOME variable in Java Environment?

Anjana
Updated on 30-Jul-2019 22:30:21

318 Views

JAVA_HOME refers to jdk/bin directory. It is used by a java based application.

How to set path in Java?

Ayyan
Updated on 13-Jun-2020 12:30:30

2K+ Views

Setting Up the Path for WindowsAssuming you have installed Java in c:\Program Files\java\jdk directory −Right-click on 'My Computer' and select 'Properties'.Click the 'Environment variables' button under the 'Advanced' tab.Now, alter the 'Path' variable so that it also contains the path to the Java executable. Example, if the path is currently set to 'C:\WINDOWS\SYSTEM32', then change your path to read 'C:\WINDOWS\SYSTEM32;c:\Program Files\java\jdk\bin'.

What happens in Java Program at compile time?

Alankritha Ammu
Updated on 13-Jun-2020 12:24:56

255 Views

During compile time, java compiler (javac) takes the source file .java file and convert it to bytecode .class file.

How to run a java program

Ayyan
Updated on 19-Feb-2024 04:11:09

262K+ Views

Compiling and running a java program is very easy after JDK installation. Following are the steps −Open a command prompt window and go to the directory where you saved the java program (MyFirstJavaProgram.java). Assume it's C:\.Type 'javac MyFirstJavaProgram.java' and press enter to compile your code. If there are no errors in your code, the command prompt will take you to the next line (Assumption: The path variable is set).Now, type 'java MyFirstJavaProgram' to run your program.You will be able to see the result printed on the window. Start learning Java with our Java tutorial from scratch.Read More

How to compile a java program

Akshaya Akki
Updated on 12-Sep-2023 02:07:51

30K+ Views

Compiling a Java program is very easy after JDK installation. Following are the steps −Open a command prompt window and go to the directory where you saved the java program. Assume it's C:\.Type 'javac MyFirstJavaProgram.java' and press enter to compile your code. If there are no errors in your code, the command prompt will take you to the next line (Assumption: The path variable is set).The file is compiled and you can see MyFirstJavaProgram.class file generated in the same folder.

How can we edit a java program?

Alankritha Ammu
Updated on 30-Jul-2019 22:30:21

508 Views

Java programs are simple text-based programs and can be edited using any text editor like notepad etc. The filename should be same as class name.

What are the key features of Java?

Debarpito Sarkar
Updated on 05-Sep-2022 12:08:11

4K+ Views

This article will help you understand what the key features of Java Programming language are. The Key features of Java Programming Language are − Java is Easy to Understand Java’s base is similar to that of C and C++ languages and it includes many important features of these languages. It removes many drawbacks and complexities of C or C++. So if one has good understanding of either C or C++, then Java language will be very familiar and easily understandable. Java is an object oriented programming language Object Oriented Programming (OOP) is an approach to standardize the programs by creating ... Read More

What does the method toArray() do?

karthikeya Boyini
Updated on 12-Mar-2020 12:16:49

636 Views

The toArray() method of the java.util.The ArrayList class returns an array containing all of the elements in this list in proper sequence (from first to the last element). This acts as a bridge between array-based and collection-based APIs.ExampleLive Demoimport java.util.ArrayList; public class ArrayListDemo {    public static void main(String[] args) {       ArrayList arrlist = new ArrayList(5);       arrlist.add(20);       arrlist.add(40);       arrlist.add(10);       arrlist.add(15);       arrlist.add(25);       for (Integer number : arrlist) {          System.out.println("Number = " + number);       ... Read More

How to convert an input stream to byte array in java?

Syed Javed
Updated on 06-Mar-2020 05:07:10

894 Views

The InputStream class in Java provides read() method. This method accepts a byte array and it reads the contents of the input stream to the given byte array.ExampleLive Demoimport java.io.BufferedInputStream; import java.io.IOException; import java.io.InputStream; public class StreamToByteArray {     public static void main(String args[]) throws IOException{            InputStream is = new BufferedInputStream(System.in);        byte [] byteArray = new byte[1024];        System.out.println("Enter some data");        is.read(byteArray);              String s = new String(byteArray);        System.out.println("Contents of the byte stream are :: "+ s);   ... Read More

Advertisements