Found 9321 Articles for Object Oriented Programming

How to call C++ functions from Java?

varun
Updated on 10-Feb-2020 10:51:32

1K+ Views

Following are the steps to use native methods.Create a header file (.h file) for a CPP program.Create CPP fileCreate a DLLIn java code, declare the method as native, load the DLL using System.loadLibrary() method and call the method.

What are native methods in Java and where should we use them?

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

380 Views

Native methods are written in a different language than java and are declared as native in Java.

What is the native keyword in Java for?

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

550 Views

The native keyword is used to declare a method as native. It means that method implementation is present in the different language.

How to convert a String to an int in Java

vanithasree
Updated on 25-Feb-2020 05:20:34

319 Views

Following example is converting a String to int.ExampleLive Demopublic class Tester {    public static void main(String[] args) {       String intString = "1234";       int value = new Integer(intString).intValue();       System.out.println(value);    } }Output1234

How to avoid Java code in jsp page?

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

216 Views

You can use JSTL, JSP Standard Tag Library or EL, Expression Language to avoid scriptlets.

Pass by reference vs Pass by Value in java

Giri Raju
Updated on 25-Feb-2020 05:22:52

4K+ Views

Call by Value means calling a method with a parameter as value. Through this, the argument value is passed to the parameter.While Call by Reference means calling a method with a parameter as a reference. Through this, the argument reference is passed to the parameter.In call by value, the modification done to the parameter passed does not reflect in the caller's scope while in the call by reference, the modification done to the parameter passed are persistent and changes are reflected in the caller's scope.But Java uses only call by value. It creates a copy of references and pass them ... Read More

Difference between HashMap and HashTable in Java.

Ankitha Reddy
Updated on 30-Jul-2019 22:30:21

20K+ Views

HashMap is non-syncronized and is not thread safe while HashTable is thread safe and is synchronized. HashMap allows one null key and values can be null whereas HashTable doesn't allow null key or value. HashMap is faster than HashTable. HashMap iterator is fail-safe where HashTable iterator is not fail-safe. HashMap extends AbstractMap class where HashTable extends Dictionary class.

Difference between Object and Class in Java

Kiran Kumar Panigrahi
Updated on 23-Jun-2023 13:45:54

1K+ Views

Classes and objects are considered as the building blocks of object-oriented programming. Every entity with state and behavior is an object. Collection of these similar kinds of objects is a class. A class can be only accessed by its objects hence securing data in it. Read this article to learn more about objects and classes in Java and how they are different from each other. What are Classes in Java? A class is a user-defined data type that acts as a blueprint for designing the objects in it. It is said to be a container that stores objects of similar ... Read More

Java command line arguments

Govinda Sai
Updated on 25-Feb-2020 05:13:48

13K+ Views

A command-line argument is an information that directly follows the program's name on the command line when it is executed. To access the command-line arguments inside a Java program is quite easy. They are stored as strings in the String array passed to main( ).ExampleThe following program displays all of the command-line arguments that it is called with -public class CommandLine {    public static void main(String args[]) {       for(int i = 0; i

Java API documentation generator

Abhinanda Shri
Updated on 25-Feb-2020 05:08:14

507 Views

Following program uses few of the important tags available for documentation comments. You can make use of other tags based on your requirements.The documentation about the AddNum class will be produced in HTML file AddNum.html but at the same time, a master file with a name index.html will also be created.import java.io.*; /**   * Add Two Numbers!   * The AddNum program implements an application that   * simply adds two given integer numbers and Prints   * the output on the screen.   *   * Note: Giving proper comments in your program makes it more   ... Read More

Advertisements