Akshaya Akki

Akshaya Akki

25 Articles Published

Articles by Akshaya Akki

25 articles

Java program to find the percentage of uppercase, lowercase, digits and special characters in a String

Akshaya Akki
Akshaya Akki
Updated on 22-Aug-2024 2K+ Views

This article will teach us how to transform a string into an array of characters in order to examine its composition. Next, we shall categorize every character as a numeric, special character, lowercase letter, or uppercase letter. The methods of Java Character class will be used to do this. For each group (uppercase, lowercase, numbers, and special characters), we'll compute the percentage and show the results.  isUpperCase() : The Java Character isUpperCase() method determines if a character is an uppercase character or not. isLowerCase() : The Java Character isLowerCase() method determines if a character is a lowercase character or not. isDigit() : The ...

Read More

What MYSQL INTERVAL() function returns if there is no bigger number in the list of arguments than the number at first argument?

Akshaya Akki
Akshaya Akki
Updated on 22-Jun-2020 149 Views

In this case, MySQL INTERVAL() function returns the index number of the last number in argument list plus 1. In other words, the last index number in the list plus 1 would be returned by this function. Following example will demonstrate it −mysql> Select INTERVAL(50,20,32,38,40); +--------------------------+ | INTERVAL(50,20,32,38,40) | +--------------------------+ | 4                        | +--------------------------+ 1 row in set (0.00 sec)

Read More

What is the benefit of using MySQL SUM() function with GROUP BY clause?

Akshaya Akki
Akshaya Akki
Updated on 22-Jun-2020 284 Views

When we use MySQL SUM() function with GROUP BY Clause the SUM() function evaluates the sum for every group specified in the GROUP BY clause. The benefit of using SUM() with GROUP BY clause is that we can easily find the total of a particular group. To understand the above concept, consider an ‘employee_tbl’ table, which is having the following records −mysql> SELECT * FROM employee_tbl; +------+------+------------+--------------------+ | id   | name | work_date  | daily_typing_pages | +------+------+------------+--------------------+ | 1    | John | 2007-01-24 |        250         | | 2    | Ram ...

Read More

How can we remove all the prefixes or suffixes from a given string in MySQL?

Akshaya Akki
Akshaya Akki
Updated on 20-Jun-2020 2K+ Views

MySQL TRIM() function is used to remove all the suffixes or prefixes or both from the string. The working of TRIM() function can be understood with the help of its syntax −SyntaxTRIM([{BOTH | LEADING | TRAILING} [str_to_remove] FROM] string)Here,  the argument BOTH means the prefixes from both left and right to be removed from the string.LEADING argument means that only leading prefixes to be removed.TRAILING argument means that only trailing prefixes to be removed.Str_to_remove is the argument which means the string we want to remove from the string.String argument means the string from which the prefixes have to be removed.Examplemysql> ...

Read More

How can we delete a single row from a MySQL table?

Akshaya Akki
Akshaya Akki
Updated on 20-Jun-2020 432 Views

We can use DELETE statement along with a WHERE clause, which identifies that particular row, to delete a row from MySQL table.Examplemysql> Select * from names; +------+-----------+ | id   | name      | +------+-----------+ | 1    | Rahul     | | 2    | Gaurav    | | 3    | Raman     | | 4    | Aarav     | | 5    | Ram       | +------+-----------+ 5 rows in set (0.00 sec) mysql> DELETE from names where id = 4; Query OK, 1 row affected (0.07 sec)The query above will delete a single row having id = 4 from table ‘names’.mysql> Select * from names; +------+-----------+ | id   | name      | +------+-----------+ | 1    | Rahul     | | 2    | Gaurav    | | 3    | Raman     | | 5    | Ram       | +------+-----------+ 4 rows in set (0.00 sec)

Read More

How can we emulate CHECK CONSTRAINT by using MySQL GENERATED COLUMN?

Akshaya Akki
Akshaya Akki
Updated on 19-Jun-2020 207 Views

As we know that MySQL supports foreign key for referential integrity but it does not support CHECK constraint. But we can emulate them by using triggers. It can be illustrated with the help of an example given below −ExampleSuppose we have a table named ‘car’ which can have the fix syntax registration number like two letters, a dash, three digits, a dash, two letters as follows −mysql> Create table car2 (number char(9)); Query OK, 0 rows affected (0.32 sec) mysql> Insert into car2 values('AB-235-YZ'); Query OK, 1 row affected (0.10 sec)The above value is a valid one but what ...

Read More

What is the difference between getter and setter in JavaScript?

Akshaya Akki
Akshaya Akki
Updated on 16-Jun-2020 1K+ Views

GetterWhen a property is accessed, the value gets through calling a function implicitly. The get keyword is used in JavaScript. An identifier, either a number or a string is allowed for set.SetterWhen a property is set, it implicitly calls a function and the value is passed as an argument. With that, the return value is set to the property itself. The set keyword is used in JavaScript. An identifier, either a number or a string is allowed for set.ExampleHere’s an example showing how to implement both getter and setterLive Demo                   ...

Read More

How to create a strikethrough text using JavaScript?

Akshaya Akki
Akshaya Akki
Updated on 15-Jun-2020 5K+ Views

To create a strikethrough text with JavaScript, use the strike() method. This method causes a string to be displayed as struck-out text as if it were in a tag.ExampleYou can try to run the following code to create a strikethrough text −Live Demo           JavaScript String strike() Method                        var str = new String("Demo Text");          document.write(str.strike());          alert(str.strike());          

Read More

Why is Java slower than C++ programs?

Akshaya Akki
Akshaya Akki
Updated on 13-Jun-2020 1K+ Views

Modern Java is quite fast and is comparable to C++ code base but it still takes lot of memory. Slowness of Java programs is primarily because of bad programming practices. But following areas are where Java can be improved.Java libraries are written keeping readability and correctness in mind, not performance.Slow String based operations as Strings are UTF-16 encoded objects and are immutable. So more String are used, more memory is required.Boundary checks on arrays also make its operations bit slow.I/O Stream operations are slow considering synchronization checks on each access.Lacking low level functionality like C also attributes to slowness in ...

Read More

How to Set Permanent Path of JDK in Windows?

Akshaya Akki
Akshaya Akki
Updated on 13-Jun-2020 1K+ Views

Following are the required steps −Assuming you have installed Java in c:\Program Files\java\jdk directory −Right-click on 'My Computer' and select 'Properties'.Click the 'Environment variables' button under the 'Advanced' tab.Now, alter the 'Path' variable so that it also contains the path to the Java executable. Example, if the path is currently set to 'C:\WINDOWS\SYSTEM32', then change your path to read 'C:\WINDOWS\SYSTEM32;c:\Program Files\java\jdk\bin'.

Read More
Showing 1–10 of 25 articles
« Prev 1 2 3 Next »
Advertisements