Found 2616 Articles for Java

How to use classes in other package in Java

Ramu Prasad
Updated on 04-Feb-2020 11:21:21

531 Views

You can understand it using an example where a Boss class is defined in payroll package.package payroll; public class Boss {    public void payEmployee(Employee e) {       e.mailCheck();    } }if the Employee class is not in the payroll package? The Boss class must then use one of the following techniques for referring to a class in a different package.The fully qualified name of the class can be used. For example −payroll.EmployeeThe package can be imported using the import keyword and the wildcard (*). For example −import payroll.*;The class itself can be imported using the import keyword. ... Read More

How to access Java package from another package

Smita Kapse
Updated on 04-Feb-2020 11:26:52

5K+ Views

You can understand it using an example where a Boss class is defined in payroll package.package payroll; public class Boss {    public void payEmployee(Employee e) {       e.mailCheck();    } }if the Employee class is not in the payroll package? The Boss class must then use one of the following techniques for referring to a class in a different package.The fully qualified name of the class can be used. For example −payroll.EmployeeThe package can be imported using the import keyword and the wild card (*). For example −import payroll.*;The class itself can be imported using the import ... Read More

How to run Java package program

Ankitha Reddy
Updated on 26-Oct-2023 02:32:02

27K+ Views

Let us look at an example that creates a package called animals. It is a good practice to use names of packages with lower case letters to avoid any conflicts with the names of classes and interfaces.Following package example contains interface named animals −/* File name : Animal.java */ package animals; interface Animal {    public void eat();    public void travel(); }Now, let us implement the above interface in the same package animals −package animals; /* File name : MammalInt.java */ public class MammalInt implements Animal {    public void eat() {       System.out.println("Mammal eats");    } ... Read More

How to compile packages in Java

Nikitha N
Updated on 04-Feb-2020 10:47:31

4K+ Views

Let us look at an example that creates a package called animals. It is a good practice to use names of packages with lower case letters to avoid any conflicts with the names of classes and interfaces.Following package example contains interface named animals −/* File name : Animal.java */ package animals; interface Animal {    public void eat();    public void travel(); }Now, let us implement the above interface in the same package animals −package animals; /* File name : MammalInt.java */ public class MammalInt implements Animal {    public void eat() {       System.out.println("Mammal eats");    } ... Read More

Java constructor return a value but, what?

Priya Pallavi
Updated on 04-Feb-2020 10:54:52

749 Views

No. Java constructor cannot return a value. If required, just create a method which calls the required constructor and returns the required value. See the example below.public class Tester {    public Tester(){}    public static Tester getInstance(){       Tester tester = new Tester();        return tester;    } }

Is there a case when finally block does not execute in Java?

Lakshmi Srinivas
Updated on 10-Aug-2023 13:52:43

800 Views

Questions related to Java exception handling are most frequent during interviews for many companies and even in exams. One such question that an interviewer might ask is whether there is a case when the finally block does not execute in Java. We will try to find the answer to this question in the simplest way possible. In general, the finally block is designed to execute regardless of whether an exception is thrown or handled in the try-catch blocks. Is there a case when finally block does not execute in Java? Before moving to the question, it is necessary to discuss ... Read More

Difference between Method Overloading and Method Overriding in Java

Kiran Kumar Panigrahi
Updated on 13-Sep-2023 15:28:25

33K+ Views

Method Overloading in Java When a class has two or more methods by the same name but different parameters, at the time of calling based on the parameters passed respective method is called (or respective method body will be bonded with the calling line dynamically). This mechanism is known as method overloading. Example of Method Overloading If you observe the following example, here we have created a class called Sample and this class has two methods with the same name (add) and return type, the only difference is the parameters they accept (one method accepts two integer variables and other ... Read More

Using custom calculation views in SAP Cloud IoT

John SAP
Updated on 30-Jul-2019 22:30:20

163 Views

To add a logic to show maximum value it hardly matters if you are using trial version or licensed version. Try using database views to add this logic simply.You can refer this link to know more technical capabilities of SAP Cloud IoT:SAP linkSAP offers a comprehensive portfolio of solutions for the Internet of Things (IoT). This in-memory IoT platform can help you quickly develop, deploy, and manage your own real-time IoT and machine-to-machine (M2M) applications. Use the platform to automate processes at the core and connect to almost anything at the edge of your network.

Automating SAP Purchase Request via Eclipse with use of QTP10

SAP ABAP Expert
Updated on 17-Feb-2020 10:12:40

106 Views

Note that Eclipse UI is JAVA based so you can automate Eclipse using QTP Java add-ins.To perform QTP Java add-in, Go to Control Panel → Add or Remove Programs and select Quickest Professional from the list. Click on Change button.To perform add-in installation, click on small black down arrow next to the cross button for Java Add-in. Clicking on it would show a small menu with 3 options as shown in the below image.

Java Web application pointing to SAP HANA locally

Sai Subramanyam
Updated on 30-Jul-2019 22:30:20

207 Views

You would require changing the connection.properties file of your local Tomcat Server (Server > Java Web Tomcat 8 Server-config/config_master/connection_data), to point to the HANA database. Here are the usual parameters that need to be configured for HANA database javax.persistence.jdbc.driver = com.sap.db.jdbc.Driver javax.persistence.jdbc.url = jdbc:sap://:/?reconnect=true&autocommit=false javax.persistence.jdbc.user = db-user javax.persistence.jdbc.password = db-pass eclipselink.target-database = HANA

Advertisements