1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
erica [24]
3 years ago
12

Write a java program that will take 2 String inputs and perform the following operation on them: a) Show length of the strings b

) Concatenate two strings c) Convert those two strings to uppercase.
Computers and Technology
1 answer:
marissa [1.9K]3 years ago
6 0

Answer:

// here is code in java.

import java.util.*;

// class definition

class Solution

{

   // main method of the class

public static void main (String[] args) throws java.lang.Exception

{

   try{

 // scanner object to read input from user

Scanner scr=new Scanner(System.in);

 // string variables

String st1,st2;

System.out.print("enter the first string:");

 // read the first string

st1=scr.nextLine();

System.out.print("enter the second string:");

 // read the second string

st2=scr.nextLine();

// part (a)

 // find length of each string

System.out.println("length of first string is: "+st1.length());

System.out.println("length of second string is: "+st2.length());

//part(b)

 // concatenate both the string

System.out.print("after Concatenate both string: ");

System.out.print(st1+st2);

// part(c)

 // convert them to upper case

System.out.println("first string in upper case :"+st1.toUpperCase());

System.out.println("second string in upper case :"+st2.toUpperCase());

   }catch(Exception ex){

       return;}

}

}

Explanation:

Read two strings st1 and st2 with scanner object.In part a, find the length of each string with the help of .length() method and print the length.In part b, concatenate both the string with + operator.In part c, convert each string to upper case with the help of .toUpperCase()  method.

Output:

enter the first string:hello

enter the second string:world!!

length of first string is: 5

length of second string is: 7

after Concatenate both string: hello world!!

first string in upper case :HELLO

second string in upper case :WORLD!!

You might be interested in
Please
levacccp [35]

Answer:

inspect

Explanation:

7 0
3 years ago
Name the tools in plant propagation.<br>Q<br>18.<br>16.<br>17.<br>19.<br>20.<br>please po asap​
Agata [3.3K]
16. Branch or tree cutter
17.paint tape
18. Knife
19. Pots
20. Waterer
6 0
2 years ago
What type of coverage pays for damage incurred as a result of theft, vandalism, fire or natural disaster?
Sloan [31]

Comprehensive or hazard insurance

5 0
3 years ago
Which of the following statements concerning a short in a series circuit is true?
Romashka [77]

Answer:

what is the answers it gave you?

6 0
2 years ago
We are continuously sending and receiving messages that may change midstream. This illustrates that____________.
8_murik_8 [283]

Answer:

Communication is a constant process and it can also be corrupted.

Explanation:

Communication is the ability to send and receive messages that can be understood. We constantly communicate with our environment verbally and or orally, using signs and language to express ourselves.

Messages sent can and should be decoded for communication to be complete. It can be corrupted on its path to the decoder, this hinders understanding.

6 0
3 years ago
Other questions:
  • When pasting an object which has been copied from a different slide, where on the slide does the object paste, assuming nothing
    15·1 answer
  • Write a function named initialMatch that takes a string parameter, text, that contains only lowercase letters and whitespace. Th
    6·1 answer
  • Which key removes all data from an active cell with one click? A. Esc B. Delete C. Tab D. F2
    9·2 answers
  • When you copy text, the selected text is copied from the original location and placed on the
    9·1 answer
  • What statement best describes Konrad Zuse?
    6·2 answers
  • What commands would return all the rows and columns in the ProductCategory table?
    7·1 answer
  • What tabs found in the Windows Task Manager dialog box
    7·1 answer
  • Which bus slot provides the highest video performance​
    8·1 answer
  • Given a vector of students, the function FinalAvg is supposed to return the average final exam score across all the students in
    6·1 answer
  • IF YOU COULD CREATE A SOCIAL NETWORK:, what would it be like? What would make it so special about the others? (If you want you c
    9·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!