Java Program to Round a Number

George John
Updated on 13-Mar-2020 10:43:07

689 Views

The java.lang.Math.round(float a) returns the closest int to the argument. The result is rounded to an integer by adding 1/2, taking the floor of the result, and casting the result to type int. Special cases −If the argument is NaN, the result is 0.If the argument is negative infinity or any value less than or equal to the value of Integer.MIN_VALUE, the result is equal to the value of Integer.MIN_VALUE.If the argument is positive infinity or any value greater than or equal to the value of Integer.MAX_VALUE, the result is equal to the value of Integer.MAX_VALUE.Exampleimport java.util.Scanner; public class RoundingDecimalPlaces ... Read More

Display English Alphabets in Java

Samual Sam
Updated on 13-Mar-2020 10:20:56

415 Views

Following is an example to display English alphabets A to Z.ExampleLive Demopublic class DisplayingAtoZ {    public static void main(String args[]){       char ch;       System.out.println("List of alphabets are ::");       for(ch = 'A'; ch

Calculate Student Grades in Java

karthikeya Boyini
Updated on 13-Mar-2020 09:57:09

17K+ Views

The following program accepts average from the user, calculates the grade and prints it.Examplepublic class CalculateStudentGrades {    public static void main(String args[]) {       Scanner sc = new Scanner(System.in);       System.out.println("Enter average of your marks (less than 100)::");       int average = sc.nextInt();       char grade;       if(average>=80){          grade = 'A';       }else if(average>=60 && average=40 && average

Largest Number Among Three Numbers in Java

Lakshmi Srinivas
Updated on 13-Mar-2020 09:53:45

4K+ Views

Comparing three integer variables is one of the simplest programs you can write at ease. Take two integer variables, say A, B& C Assign values to variables If A is greater than B & C, Display A is the largest value If B is greater than A & C, Display B is the largest value If C is greater than A & B, Display A is the largest value Otherwise, Display A, B & C are not unique valuesExampleimport java.util.Scanner; public class LargestOfThreeNumbers {    public static void main(String args[]){       Scanner sc =new Scanner(System.in);       System.out.println("Enter 1st number :");     ... Read More

Find Area of a Circle in Java

karthikeya Boyini
Updated on 13-Mar-2020 09:43:27

22K+ Views

Area of a circle is the product of the square of its radius, and the value of PI, Therefore, to calculate the area of a rectangleGet the radius of the circle.Calculate the square of the radius.Calculate the product of the value of PI and the value of the square of the radius.Print the result.Exampleimport java.util.Scanner; public class AreaOfCircle {    public static void main(String args[]){       int radius;       double area;       Scanner sc = new Scanner(System.in);       System.out.println("Enter the radius of the circle ::");       radius = sc.nextInt();   ... Read More

HTTP/2 Client in Java 9

raja
Updated on 13-Mar-2020 08:52:38

513 Views

Http/2 Client API introduced in Java 9. It has more performance improvements over Http/1.1 and also supports server-side push events. This makes the website efficient and faster to browse. Http/2 Client is an incubator module named jdk.incubator.httpclient, which means that all features are still not finalized, and new changes may come in future versions of java. It exports jdk.incubator.http package that contains all public APIs.To use Http/2 Client, we need to use the incubator module, we simply pass the httpclient module into JShell using the "–add-modules" command as belowC:\>jshell -v --add-modules jdk.incubator.httpclient | Welcome to JShell -- Version 9.0.4 | For an introduction type: /help introExamplejshell> import jdk.incubator.http.*; jshell> HttpClient httpClient ... Read More

Find the Area of a Triangle in Java

George John
Updated on 13-Mar-2020 08:19:28

4K+ Views

Area of a triangle is half the product of its base and height. Therefore, to calculate the area of a triangle.Get the height of the triangle form the user.Get the base of the triangle form the user. Calculate their product and divide the result with 2.Print the final result.Exampleimport java.util.Scanner; public class AreaOfTriangle {    public static void main(String args[]){       int height, base, area;       Scanner sc = new Scanner(System.in);       System.out.println("Enter the height of the triangle ::");       height = sc.nextInt();       System.out.println("Enter the base of the triangle ::"); ... Read More

Port Number for SAP HANA Cockpit Offline Administration

SAP Developer
Updated on 13-Mar-2020 08:17:06

976 Views

Following perquisites should be met for accessing SAP HANA cockpit for offline administration −To access this, you need credentials of the operating system user (adm user) that was created when the system was installed.Communication port 1129: As this Port 1129 is required for communication with the SAP Host Agent in a standalone browser via HTTPS.HANA Cockpit is configured with HTTP accessWeb browser supports the SAPUI5 library sap.m.

Access SAP HANA Cockpit for Offline Administration

SAP Developer
Updated on 13-Mar-2020 08:15:09

464 Views

First open SAP HANA cockpit by using below URL- https://:43/sap/hana/admin/cockpit or http://:80/sap/hana/admin/cockpit2Next is to navigate to SAP HANA Database Administration group → Select SAP HANA Cockpit for Offline Administration

Start and Stop HANA System in SAP HANA Studio

SAP Developer
Updated on 13-Mar-2020 08:14:13

1K+ Views

In SAP HANA studio, you can start/stop SAP HANA system. In a system with multitenant database containers, all tenant databases will be started except those that were individually stopped. To perform start/stop, right click on HANA system → Configuration and Monitoring → Stop System…

Advertisements