Calculate Mean of Given Numbers in Java

Ankith Reddy
Updated on 19-Jun-2020 14:54:39

6K+ Views

Mean is an average value of given set of numbers. It is calculated similarly to that of the average value. Adding all given number together and then dividing them by the total number of values produces mean.For Example Mean of 3, 5, 2, 7, 3 is (3 + 5 + 2 + 7 + 3) / 5 = 4AlgorithmTake an integer set A of n values.Add all values of A together.Divide result of Step 2 by n.The result is mean of A's values.Programpublic class CaculatingMean {    public static void main(String args[]){       float mean;       int ... Read More

Find Cube Root of a Given Number in Java

George John
Updated on 19-Jun-2020 14:51:46

2K+ Views

Following is an example to find the cube root of a given number.Programimport java.util.Scanner; public class FindingCubeRoot {    public static void main(String args[]){       double i, precision = 0.000001;       System.out.println("Enter a number ::");       Scanner sc = new Scanner(System.in);       int num = sc.nextInt();       for(i = 1; (i*i*i)

CopyOnWriteArraySet Class in Java

Samual Sam
Updated on 19-Jun-2020 14:45:11

733 Views

Class declarationpublic class CopyOnWriteArraySet    extends AbstractSet implements SerializableCopyOnWriteArraySet class uses CopyOnWriteArrayList internally for all of its operations and thus possesses the basic properties of CopyOnWriteArrayList.CopyOnWriteArraySet is a thread-safe.CopyOnWriteArraySet is to be used in Thread based environment where read operations are very frequent and update operations are rare.Iterator of CopyOnWriteArraySet will never throw ConcurrentModificationException.Any type of modification to CopyOnWriteArraySet will not reflect during iteration since the iterator was created.Set modification methods like remove, set and add are not supported in the iteration. This method will throw UnsupportedOperationException.CopyOnWriteArraySet MethodsFollowing is the list of important methods available in the CopyOnWriteArraySet class.Sr.No.Method & ... Read More

CopyOnWriteArrayList Class in Java

karthikeya Boyini
Updated on 19-Jun-2020 14:41:11

5K+ Views

Class declarationpublic class CopyOnWriteArrayList    extends Object implements List, RandomAccess, Cloneable, SerializableCopyOnWriteArrayList is a thread-safe variant of ArrayList where operations which can change the ArrayList (add, update, set methods) creates a clone of the underlying array.CopyOnWriteArrayList is to be used in a Thread based environment where read operations are very frequent and update operations are rare.Iterator of CopyOnWriteArrayList will never throw ConcurrentModificationException.Any type of modification to CopyOnWriteArrayList will not reflect during iteration since the iterator was created.List modification methods like remove, set and add are not supported in the iteration. This method will throw UnsupportedOperationException.null can be added to the ... Read More

Use of Different Files in SAP HANA Cockpit for Offline Administration

SAP Developer
Updated on 19-Jun-2020 14:25:31

219 Views

Start, Restart, Stop System Operations: To perform start/stop/restart of HANA systemDiagnosis Files: This is used to access log, trace and other diagnosis files.Troubleshoot Unresponsive System: You can use this to trigger the collection of transactional information and displays this information for troubleshooting performance issues.SAP HANA Documentation - SAP HANA Offline Administration: You can open SAP HANA documentation that describes those administration tasks that you can perform using the SAP HANA cockpit for offline administrationSAP HANA Cockpit: This option is used to open SAP HANA cockpit where you can access all applications for the online administration of SAP HANA system.Read More

Date and Time Functions in DBMS

David Meador
Updated on 19-Jun-2020 14:23:27

5K+ Views

The date and time functions in DBMS are quite useful to manipulate and store values related to date and time.The different date and time functions are as follows −ADDDATE(DATE, DAYS)The numbers of days in integer form (DAYS) is added to the specified date. This is the value returned by the function. For example −sql> SELECT ADDDATE('2018-08-01', 31); +---------------------------------------------------------+ | DATE_ADD('2018-08-01', INTERVAL 31 DAY)                 | +---------------------------------------------------------+ | 2018-09-01                                             | +---------------------------------------------------------+ 1 ... Read More

SELECT Statement and its Clauses in DBMS

David Meador
Updated on 19-Jun-2020 14:13:22

5K+ Views

The select statement is used to get the required data from the database according to the conditions, if any. This data is returned in the form of a table.The basic syntax of the select statement is −Select column 1, column 2 ... column N From table_nameAn example of the select statement is −Student_NumberStudent_NameStudent_PhoneStudent_MarksStudent_MajorSubject1Andrew661592728495Literature2Sara658365486565Maths3Harry464756746348Literature4Sally653783708430Literature5Anne745733773288MathsQuery −Select Student_Name From StudentThis query yields the following result −Student_NameAndrewSaraHarrySallyAnneClauses in Select statementThe example of select statement given above is quite simple and not that useful in practice. So, there are many other clauses associated with select statement that make it more meaningful. Some of these are ... Read More

Store Invalid Date like February 30 in MySQL Date Column

Ankitha Reddy
Updated on 19-Jun-2020 13:57:07

228 Views

Suppose we want to store the date such as February 30 in a MySQL table then we must have to first set ALLOW_INVALID_DATES mode enabled.For example, I am trying to add, without enabling ALLOW_INVALID_DATES mode, such kind of date in a table then MySQL will give an error as follows −mysql> Insert into date_testing(date) values('2017-02-30'); ERROR 1292 (22007): Incorrect date value: '2017-02-30' for column 'Date' at row1Now we need to enable ALLOW_INVALID_DATES mode enabled as follows −mysql> SET sql_mode = 'ALLOW_INVALID_DATES'; Query OK, 0 rows affected (0.00 sec) mysql> Insert into date_testing(date) values('2017-02-30'); Query OK, 1 row affected (0.14 ... Read More

Different Unit Values for MySQL INTERVAL Keyword

Smita Kapse
Updated on 19-Jun-2020 13:56:19

160 Views

Different unit values which can be used with MySQL INTERVAL keyword are as follows −MICROSECONDThis unit will be used for adding or subtracting the number of specified microseconds from the current time or as provided by the user.mysql> Select NOW()+INTERVAL 100 MICROSECOND +--------------------------------+ | NOW()+INTERVAL 100 MICROSECOND | +--------------------------------+ | 2017-10-28 18:47:25.000100     | +--------------------------------+ 1 row in set (0.00 sec)Above query will add 100 microseconds to the current date & time with the help of MySQL INTERVAL keyword.mysql> Select '2017-02-25 05:04:30' + INTERVAL 100 Microsecond; +--------------------------------------------------+ | '2017-02-25 05:04:30' + INTERVAL 100 Microsecond | +--------------------------------------------------+ | ... Read More

Insert Values in MySQL Without Specifying Column Names

Kumar Varma
Updated on 19-Jun-2020 13:55:10

3K+ Views

For inserting the values in the column without specifying the names of the columns in INSERT INTO statement, we must give the number of values that matches the number of columns in the table along with taking care about the data type of that column too.ExampleIn the example below we have inserted the values without specifying the name of the column.mysql> Insert into student values(100, 'Gaurav', 'Ph.D'); Query OK, 1 row affected (0.08 sec) mysql> Select * from student; +--------+--------+--------+ | RollNO | Name   | Class  | +--------+--------+--------+ | 100    | Gaurav | Ph.D   | +--------+--------+--------+ ... Read More

Advertisements