Tutorialspoint

How can you use plastic without harming the environment?

Prasanna Kotamraju
Answered on 14th Dec, 2018

Plastics are tough and durable and have versatile applications. We have to admit that we cannot completely avoid the usage of plastic, even though we know that they are harming the ecosystem and cannot be decomposed easily. Some plastics may take decades and some may take centuries to decompose.So the ... Read More

How can you make your kid help in your household?

Prasanna Kotamraju
Answered on 14th Dec, 2018

Doing household chores is not a joyful pass time for even an adult. And you want to train your kid to help you ... It really needs tact and patience to keep the kid engaged. Still, kids learn some valuable lessons in life and it is worth taking out that ... Read More

What are some of the universal vibrations that help you to recover from bad situations?

Prasanna Kotamraju
Answered on 14th Dec, 2018

Good and bad situations are a part of life. How you handle the situations is the challenge. When you are stuck in bad situations, there are certain things you can do to invite positive vibrations to help you come out of such situations. The universe is always ready to give ... Read More

What is the new age definition of feminism?

Prasanna Kotamraju
Answered on 14th Dec, 2018

Feminism at its core is about getting equal opportunities for men and women. It is in the nature that men and women are biologically and physically different. It is also scientifically proven that women have more multitasking capacity than men. Given equal education, exposure and opportunities, women have proven that ... Read More

Delete all whitespaces from a String in Java

karthikeya Boyini
Answered on 14th Dec, 2018

To delete all whitespaces from a string, use the replaceAll() method and replace every whitespace with empty.Let’s say the following is our string.String str = "This is it!";Now, let us replace the whitespaces that will eventually delete them.String res = str.replaceAll("\\s+", "");Example Live Demopublic class Demo { public ... Read More

Java Program to swap the case of a String

Samual Sam
Answered on 14th Dec, 2018

To swap the case of a string, use.toLowerCase() for title case string.toLowerCase() for uppercase stringtoUpperCase() for lowercase stringLoop through what we discussed above for all the characters in the sting.for (int i = 0; i > len; i++) { c = str.charAt(i); // title ... Read More

Java Program to construct one String from another

karthikeya Boyini
Answered on 14th Dec, 2018

To construct on string from another, firstly take a charcter array for the first string.char ch[] = { 'A', 'M', 'I', 'T' }; String str1 = new String(ch);The above forms first string. Now, let us created another string from the first string.String str2 = new String(str1);In this way, we can ... Read More

What's the meaning of the phrase 'what you seek is seeking you'?

Prasanna Kotamraju
Answered on 14th Dec, 2018

As per the law of attraction propounded by philosophers all over the world "The universe will conspire to give you, what you seek intensely"."If you desperately want something, the Universe offers it to you on a platter, " says Modern-day philosopher Rhonda Byrne in her book, The Secret.If you have ... Read More

Java Program to count all vowels in a string

Samual Sam
Answered on 14th Dec, 2018

Let’s say the following is our string.String str = "!Demo Text!";To count vowels, loop through each every character and check for any of the vowel i.e.if(c == 'a' || c == 'e' || c == 'i' || c == 'o' || c == 'u') { ++vowelsCount; }The ... Read More

Extracting a substring as an array of characters in Java

karthikeya Boyini
Answered on 14th Dec, 2018

To extract a substring as an array of characters in Java, use the getChars() method.Let’s say the following is our string and character array.String str = "World is not enough!"; char[] chArr = new char[10];Now, use the getChars() method to extract a substring.str.getChars(13, 19, chArr, 0);The above substring is an ... Read More

Creating a string from a subset of the array elements in Java

Samual Sam
Answered on 14th Dec, 2018

To get a string from a subset of the character array elements, use the copyValueOf() method. This method returns a String that represents the character sequence in the array specified.Here is our character array.char[] ch = { 'T', 'E', 'S', 'T', 'I', 'N', 'G'};Now, let us create a string from ... Read More

What are the achievements you are most proud of?

Prasanna Kotamraju
Answered on 14th Dec, 2018

It is very important in your life to count your blessings and feel good about your achievements. That will give you positive aura which brings more success to your life. Psychologists around the world say make a habit of thanking God for what you got in life instead of always ... Read More

Creating String Object from certain part of a character Array in Java

karthikeya Boyini
Answered on 14th Dec, 2018

Here is our character array.char[] ch = { 'T', 'E', 'S', 'T', 'I', 'N', 'G'};Create string object from some part of a string using the following String constructor. Through this we are fetching substring “IN” from the character array.String str = new String(ch, 4, 2);Example Live Demopublic class Demo { ... Read More

Creating String Object from Character Array in Java

Samual Sam
Answered on 14th Dec, 2018

Here is our character array.char[] ch = { 'T', 'E', 'S', 'T'};To create string object from the above character array is quite easy. Add the array to the string parameter as shown below −String str = new String(ch);Example Live Demopublic class Demo { public static void main(String[] args) ... Read More

Argument Index in Java

karthikeya Boyini
Answered on 14th Dec, 2018

Argument indices allow programmers to reorder the output. Let us see an example.Example Live Demopublic class Demo {    public static void main(String[] args) {       System.out.printf("Before reordering = %s %s %s %s %s %s\n", "one", "two", "three", "four", "five", "six" );       System.out.printf("After reordering = %6$s ... Read More

Advertisements
Loading...
Unanswered Questions View All