Java Technologies Articles

Page 4 of 4

What is JAVA_HOME variable in Java Environment?

Anjana
Anjana
Updated on 30-Jul-2019 543 Views

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

Read More

How to set Java Path in Linux OS?

Manikanth Mani
Manikanth Mani
Updated on 30-Jul-2019 477 Views

Environment variable PATH should be set to point to where the Java binaries have been installed. Refer to your shell documentation if you have trouble doing this.Example, if you use bash as your shell, then you would add the following line to the end of your '.bashrc: export PATH=/path/to/java:$PATH'

Read More

How to set JAVA_HOME for Java in Linux?

Ayyan
Ayyan
Updated on 30-Jul-2019 296 Views

Assuming you have installed Java in \usr\local\java\jdk directory −if you use bash as your shell, then you would add the following line to the end of your '.bashrc: export JAVA_HOME=\usr\local\java\jdk'

Read More

How to set JAVA_HOME for Java in Mac OS?

Manikanth Mani
Manikanth Mani
Updated on 30-Jul-2019 762 Views

Assuming you have installed Java in \usr\local\java\jdk directory −if you use bash as your shell, then you would add the following line to the end of your '.bashrc: export JAVA_HOME=\usr\local\java\jdk'

Read More

Global variables in Java

Arushi
Arushi
Updated on 30-Jul-2019 986 Views

There is no global variables support in Java. Static variables can be used as an alternate solution for global variables.

Read More

Java Variable Narrowing Example

George John
George John
Updated on 30-Jul-2019 2K+ Views

Narrowing refers to passing a higher size data type like int to a lower size data type like short. It may lead to data loss. Casting is required for narrowing conversion. Following program output will be 44. public class MyFirstJavaProgram { public static void main(String []args) { int a = 300; byte b = (byte)a; // narrowing System.out.println(b); } }

Read More

What is Java Method Area?

Ayyan
Ayyan
Updated on 30-Jul-2019 2K+ Views

JVM has a method area common across all the threads. It contains per-class elements like constant pool, fields, method local data, method code, constructor codes etc. which are used in class and initialization of objects/interfaces.This method area gets created during JVM start-up. It is generally part of Heap area. It could be of fixed size or vary. Its memory may not be contiguous. JVM implementation can give control to programmer over Method area creation, its sizing etc. If method area memory is not sufficient to satisfy an allocation request then JVM throws OutOfMemoryError.

Read More

Atomic variables in Java

George John
George John
Updated on 30-Jul-2019 514 Views

Yes, from Java 8 onwards, java.util.concurrent.atomic package contains classes which support atomic operations on single variables preventing race conditions or do not face synchronization issues. All classes in the atomic package have get/set methods. Each set method has a happens-before relationship with any subsequent get() method call on the same variable. import java.util.concurrent.atomic.AtomicInteger; class AtomicCounter { private AtomicInteger counter = new AtomicInteger(0); public void increment() { counter.incrementAndGet(); } public void decrement() { counter.decrementAndGet(); } public int value() { return counter.get(); } }

Read More

Differences between & and && operators in Java.

Kumar Varma
Kumar Varma
Updated on 30-Jul-2019 8K+ Views

& is a bitwise operator and compares each operand bitwise.It is a binary AND Operator and copies a bit to the result if it exists in both operands.Assume integer variable A holds 60 and variable B holds 13 then  (A & B) will give 12 which is 0000 1100.Whereas && is a logical AND operator and operates on boolean operands. If both the operands are true, then the condition becomes true otherwise it is false. Assume boolean variable A holds true and variable B holds false then (A && B) is false.& is to be used during bitwise operations and && is useful during logical operations.

Read More

Java Boolean operators

Fendadis John
Fendadis John
Updated on 30-Jul-2019 10K+ Views

There are following boolean operators supported by Java language.Assume variable A holds 10 and variable B holds 20, then −OperatorDescriptionExample== (equal to)Checks if the values of two operands are equal or not, if yes then condition becomes true.(A == B) is not true.!= (not equal to)Checks if the values of two operands are equal or not, if values are not equal then condition becomes true.(A != B) is true.> (greater than)Checks if the value of left operand is greater than the value of right operand, if yes then condition becomes true.(A > B) is not true.< (less than)Checks if the ...

Read More
Showing 31–40 of 40 articles
« Prev 1 2 3 4 Next »
Advertisements