Most Promising Technical Courses in India

Ridhi Arora
Updated on 30-Jul-2019 22:30:24

130 Views

India is a country which offers good education with a large number of professional and non-professional courses. However, any course one takes up must depend on two factors- How much passionate one is about that course and how much scope does that course offer in terms of future job opportunities especially.Technical Courses Offering a Promising FutureB.Tech: An acronym for Bachelors in Technology, this is probably one of the most widely chosen courses in India. The reason being it lands the candidate into a four-year program which will eventually turn him/her into an engineer. Now, we all know how much significance ... Read More

Static Import the Math Class Methods in Java

Arushi
Updated on 30-Jul-2019 22:30:24

20K+ Views

Static import means that the fields and methods in a class can be used in the code without specifying their class if they are defined as public static.The Math class method sqrt() in the package java.lang is static imported.A program that demonstrates this is given as follows:Example Live Demoimport static java.lang.Math.sqrt; public class Demo {    public static void main(String[] arg) {       double num = 36.0;       System.out.println("The number is: " + num);       System.out.println("The square root of the above number is: " + sqrt(num));    } }OutputThe number is: 36.0 The square root ... Read More

Specify Decimal Precision and Scale in MySQL using phpMyAdmin

Chandu yadav
Updated on 30-Jul-2019 22:30:24

2K+ Views

You need to select a database when you are creating a table. Right now, I have a sample database. The snapshot is as follows:Now you need to give the table name as well as the number of columns you want:After that you need to press Go button. Now, the following section would be visible:The DECIMAL requires two parameter i.e. Total Number of Digit and second one is DigitAfterDecimalPoint.The structure of DECIMAL is as follows:DECIMAL(X, Y)Here, X is TotalNumberOfDigit and Y is DigitAfterDecimalPoint.Let us see an example:DECIMAL(6, 4)Above, we will be having 6 digit sand 2 digit safter decimal point. For ... Read More

Set Decimal Place of a BigDecimal Value in Java

Samual Sam
Updated on 30-Jul-2019 22:30:24

5K+ Views

We have the following BigDecimal value −BigDecimal val1 = new BigDecimal("37578975587.876876989");We have set the decimal place to be −int decPlaces1 = 3;Now, we will use the ROUND_DOWN field to set the rounding mode to round towards zero −// ROUND_DOWN val1 = val1.setScale(decPlaces1, BigDecimal.ROUND_DOWN); String str1 = val1.toString(); System.out.println("Result = "+str1);To set decimal place of a BigDecimal value in Java, try the following code −Example Live Demoimport java.math.BigDecimal; public class Demo { public static void main(String[] argv) throws Exception { int decPlaces1 = 3; int decPlaces2 = ... Read More

Formatting Minute in M Format in Java

karthikeya Boyini
Updated on 30-Jul-2019 22:30:24

382 Views

The “m” format is to format minutes i.e. 1, 2, 3, 4, etc. Here, we will use the following.SimpleDateFormat("m");Let us see an example −// displaying minutes in m format SimpleDateFormat simpleformat = new SimpleDateFormat("m"); String strMinute = simpleformat.format(new Date()); System.out.println("Minutes in m format = "+strMinute);Above, we have used the SimpleDateFormat class, therefore the following package is imported.import java.text.SimpleDateFormat;The following is an example −Example Live Demoimport java.text.Format; import java.text.SimpleDateFormat; import java.util.Date; import java.util.Calendar; public class Demo { public static void main(String[] args) throws Exception { // displaying current date and time ... Read More

Most Suitable MySQL Type for Price Column

Rishi Rathor
Updated on 30-Jul-2019 22:30:24

24K+ Views

The best type for price column should be DECIMAL. The type DECIMAL stores the value precisely.For Example - DECIMAL(10, 2) can be used to store price value. It means the total digit will be 10 and two digits will be after decimal point.To understand the type DECIMAL, let us create a table.mysql> create table PriceDemo    −> (    −> ProductPrice DECIMAL(10, 2)    −> ); Query OK, 0 rows affected (0.60 sec)Now insert some records in the table in the form of price. The query to insert records is as follows −mysql> insert into PriceDemo values(12345.67); Query OK, 1 row ... Read More

Find Max and Second Max Salary for MySQL Employee Table Using Subquery

Chandu yadav
Updated on 30-Jul-2019 22:30:24

250 Views

You can get max and second max salary from an Employee table using subquery.Let us first create a table. The query to create a table is as follows −mysql> create table EmployeeMaxAndSecondMaxSalary    -> (    -> EmployeeId int,    -> Employeename varchar(20),    -> EmployeeSalary int    -> ); Query OK, 0 rows affected (0.88 sec)Insert some records in the table using insert command −mysql> insert into EmployeeMaxAndSecondMaxSalary values(1, 'John', 34566); Query OK, 1 row affected (0.20 sec) mysql> insert into EmployeeMaxAndSecondMaxSalary values(2, 'Bob', 56789); Query OK, 1 row affected (0.17 sec) mysql> insert into EmployeeMaxAndSecondMaxSalary values(3, ... Read More

Use Static Import for sqrt and pow Methods in Java Math Class

Fendadis John
Updated on 30-Jul-2019 22:30:24

955 Views

Static import means that the fields and methods in a class can be used in the code without specifying their class if they are defined as public static.The Math class methods sqrt() and pow() in the package java.lang are static imported. A program that demonstrates this is given as follows:Example Live Demoimport static java.lang.Math.sqrt; import static java.lang.Math.pow; public class Demo {    public static void main(String args[]) {       double num = 4.0;       System.out.println("The number is: " + num);       System.out.println("The square root of the above number is: " + sqrt(num));       ... Read More

Connection Status Function in PHP

Samual Sam
Updated on 30-Jul-2019 22:30:24

175 Views

The connection_status() function returns the connection status.Syntaxconnection_status()ParametersNAReturnThe connection_status() function returns the following possible values. This is the status bitfield −0 - CONNECTION_NORMAL - connection is running normally1 - CONNECTION_ABORTED - connection is aborted by user or network error2 - CONNECTION_TIMEOUT - connection timed out3 - CONNECTION_ABORTED & CONNECTION_TIMEOUTExampleThe following is an example − Live Demo

Implement While Loop with If Statement in MySQL

George John
Updated on 30-Jul-2019 22:30:24

585 Views

The following is an example to implement MySQL WHILE LOOP with IF statement. We are using in a stored procedureThe following is the query to create our stored procedure:mysql> DELIMITER // mysql> create procedure sp_getDaysDemo() -> BEGIN -> SELECT MONTH(CURDATE()) INTO @current_month; -> SELECT MONTHNAME(CURDATE()) INTO @current_monthname; -> SELECT DAY(LAST_DAY(CURDATE())) INTO @total_numberofdays; -> SELECT CAST(DATE_FORMAT(NOW() ,'%Y-%m-01') as DATE)INTO @check_weekday; -> SELECT DAY(@check_weekday) INTO @check_day; -> SET @count_days = 0; -> SET @workdays = 0; ... Read More

Advertisements