Alankritha Ammu

Alankritha Ammu

27 Articles Published

Articles by Alankritha Ammu

Page 2 of 3

Write a java program to tOGGLE each word in string?

Alankritha Ammu
Alankritha Ammu
Updated on 11-Mar-2026 1K+ Views

You can change the cases of the letters of a word using toUpperCase() and toLowerCase() methods.Split each word in the string using the split() method, change the first letter of each word to lower case and remaining letters to upper case.Examplepublic class Sample{    public static void main(String args[]){       String sample = "Hello How are you";       String[] words = sample.split(" ");       String result = "";       for(String word:words){          String firstSub = word.substring(0, 1);          String secondSub = word.substring(1);          result = result+firstSub.toLowerCase()+secondSub.toUpperCase()+" ";       }       System.out.println(result);    } }OutputhELLO hOW aRE yOU

Read More

String Concatenation by concat() method.

Alankritha Ammu
Alankritha Ammu
Updated on 11-Mar-2026 272 Views

You can concatenate two strings using the concat() method of the String class. This class concatenates the specified string to the end of this string.Examplepublic class Test {    public static void main(String args[]){       String str1 = "Krishna";       String str2 = "Kasyap";       System.out.println(str1.concat(str2));    } }OutputkrishnaKasyap

Read More

How to convert a Java String to an Int?

Alankritha Ammu
Alankritha Ammu
Updated on 11-Mar-2026 409 Views

The parseXxx() method is used to get the primitive data type of a certain String. In this case to convert a String to integer you could use the parseInt() method.Examplepublic class Test {    public static void main(String args[]) {       int x =Integer.parseInt("9");       double c = Double.parseDouble("5");       int b = Integer.parseInt("444",16);       System.out.println(x);       System.out.println(c);       System.out.println(b);    } }Output9 5.0 1092

Read More

How can we use a subquery that contains a reference to a table that also appears in the outer query?

Alankritha Ammu
Alankritha Ammu
Updated on 22-Jun-2020 850 Views

A subquery that contains a reference to a table that also appears in the outer query is called a correlated subquery. In this case,  MySQL evaluates from inner query to the outer query. To understand it we are having the following data from table ‘cars’ −mysql> Select * from Cars; +------+--------------+---------+ | ID   | Name         | Price   | +------+--------------+---------+ | 1    | Nexa         | 750000  | | 2    | Maruti Swift | 450000  | | 3    | BMW          | 4450000 | | 4 ...

Read More

What are MySQL group functions?

Alankritha Ammu
Alankritha Ammu
Updated on 22-Jun-2020 238 Views

Group functions are the function which applied to a group of rows or in other words group functions operate on sets of values. The following table gives the Description of MySQL group functions −Sr.No.Name & Description1AVG()It returns the average value of the argument.2BIT_AND()It returns bitwise AND.3BIT_ORIt returns bitwise OR.4BIT_XOR()It returns bitwise XOR.5COUNT()It returns a count of the number of rows returned.6COUNT(DISTINCT)It returns the count of a number of different values.7GROUP_CONCAT()It returns a concatenated string.8MAX()It returns the maximum value.9MIN()It returns the minimum value.10ST()It returns the population standard deviation.11STDDEV()It returns the population standard deviation.12STDDEV_POP()It returns the population standard deviation.13STDDEV_SAMP()It returns the sample ...

Read More

What MySQL returns if we provide value larger than 255 as argument to MySQL CHAR() function?

Alankritha Ammu
Alankritha Ammu
Updated on 22-Jun-2020 161 Views

MySQL converts the arguments of CHAR() function which is greater than 255 to multiple result bytes. For example, CHAR(260) is equivalent to CHAR(0,1,0,4). It can be more clear with the help of following statements −mysql> Select HEX(CHAR(256)),HEX(CHAR(1,0)); +----------------+----------------+ | HEX(CHAR(256)) | HEX(CHAR(1,0)) | +----------------+----------------+ | 0100           | 0100           | +----------------+----------------+ 1 row in set (0.00 sec)The above result set shows that CHAR(256) is equivalent to CHAR(1,0).

Read More

How can we add day/s in the date stored in a column of MySQL table?

Alankritha Ammu
Alankritha Ammu
Updated on 22-Jun-2020 247 Views

Two functions can be used for this purpose and in both the functions we need to provide column name as an argument along with INTERVAL keyword. The functions are as follows −DATE_ADD() functionThe syntax of this function is DATE_ADD(date, INTERVAL expression unit). It can be demonstrated by following the example which uses the data from table ‘collegedetail’ −mysql> Select estb, DATE_ADD(estb, INTERVAL 10 DAY) from collegedetail; +------------+---------------------------------+ | estb | DATE_ADD(estb, INTERVAL 10 DAY)       | +------------+---------------------------------+ | 2010-05-01 | 2010-05-11                      | | 1995-10-25 | 1995-11-04     ...

Read More

What would be the output of MySQL ELT() function if the index number, provided as an argument, is not an integer?

Alankritha Ammu
Alankritha Ammu
Updated on 20-Jun-2020 182 Views

As we know the 1st argument of ELT() function must be an integer value but when we provide index number which is not an integer the MySQL ELT() function returns NULL with a warning.Examplemysql> select ELT('one','Ram,is,good,boy')As Result; +--------+ | Result | +--------+ | NULL   | +--------+ 1 row in set, 1 warning (0.00 sec) mysql> Show Warnings; +---------+------+------------------------------------------+ | Level   | Code | Message                                  | +---------+------+------------------------------------------+ | Warning | 1292 | Truncated incorrect INTEGER value: 'one' | +---------+------+------------------------------------------+ 1 row in set (0.00 sec)

Read More

How to set JAVA_HOME for Java in Windows?

Alankritha Ammu
Alankritha Ammu
Updated on 13-Jun-2020 1K+ Views

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, add the 'JAVA_HOME' variable and set the path to the c:\Program Files\java\jdk'.

Read More

What happens in Java Program at compile time?

Alankritha Ammu
Alankritha Ammu
Updated on 13-Jun-2020 507 Views

During compile time, java compiler (javac) takes the source file .java file and convert it to bytecode .class file.

Read More
Showing 11–20 of 27 articles
Advertisements