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
Evidence left behind by participants or observers is an example of what kind of resource?
Natasha2012 [34]
The answer should be D
6 0
3 years ago
Read 2 more answers
It is possible to collaborate on a presentation with a group of people using the Internet.
DerKrebs [107]

Answer:

True

Explanation:

4 0
3 years ago
les agrees to install a new hard drive and software on marilee's computer in exchange for four of her used textbooks. after he i
WARRIOR [948]

Marilee can sue for breach of contract, because Les had a preexisting duty to do all of the work.

What is hard drive ?

The physical device that houses all of your digital stuff is a hard disk. Digital stuff that is kept on a hard drive includes your papers, photos, music, videos, applications, application preferences, and operating system. There are internal and external hard drives.

What is software?

Software is a collection of instructions, data, or computer programs that are used to run machines and carry out particular activities. It is the antithesis of hardware, which refers to a computer's external components. A device's running programs, scripts, and applications are collectively referred to as "software" in this context.

What does running program means?

Double-click the executable file or the shortcut icon pointing to the executable file on Windows to start the program. If you find it difficult to double-click an icon, you can highlight it by clicking it once and then using the Enter key on the keyboard.

Learn more about hardware and software click here:

brainly.com/question/24231393

#SPJ4

8 0
11 months ago
The envelope method, notebook and pencil, and online software are all methods of ______.
coldgirl [10]

Answer:

communication

Explanation:

5 0
3 years ago
Read 2 more answers
Coefficient of x in expansion (x+3)(x-1)<br>​
neonofarm [45]

Answer:

the coefficient of x here is 4

Explanation:

pls let me know if its wrong or right ..i"ll try another way than:?

5 0
3 years ago
Read 2 more answers
Other questions:
  • How many 32 bit integers can be stored in 16 byte cache block in matlab?
    15·1 answer
  • 3. Before you get ready to go diving, you want to explore the area. You see a small snowpack across a small bridge, a short walk
    11·1 answer
  • When creating a presentation you should use a blank as a starting point?
    15·1 answer
  • is used to reduce the chance of an individual violating information security and breaching the confidentiality, integrity, or av
    6·1 answer
  • Why is there no ide length or timing for study breaks?​
    12·1 answer
  • The File method lastModified() returns
    10·1 answer
  • Trudy is preparing a reply to an email message. Before she could send out the message, she is called for a meeting. If Trudy has
    6·2 answers
  • PLEASE HURRY!!!
    11·1 answer
  • What correctly describes the features of the service called kickstarter?
    14·2 answers
  • A eclipse occurs at a full moon when the moon passes between earth and the sun
    8·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!