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
lutik1710 [3]
2 years ago
6

Write a method named showChar. The method should accept two arguments: a reference to a String object and an integer. The intege

r argument is a character position within the String, with the first character being at position 0. When the method executes, it should display the character at that character position. The method does not return anything. Here is an example of a call to the method: showChar("New York", 2); In this call, the method will display the character w because it is in position 2. Demonstrate the method in a complete program. Sample Run java Method_showChar Enter a line of text: The elevation of Mount Everest is 29,029 feet (8,848·in·meters)↵ Enter yourindex:3 5↵ 9↵
Computers and Technology
1 answer:
matrenka [14]2 years ago
5 0

A complete program with the method ShowCar:

import java.util.Scanner; // header file

public class ShowChar

{

public static void main(String[] args)

{

String lnOfText;

int i;

Scanner input = new Scanner(System.in);

System.out.print("Enter a line of text:");

lnOfText = input.nextLine();

System.out.print(" Enter your index: ");

i = input.nextInt();

show_Char(lnOfText,i);

}

public static void show_Char(String str_a, int i)

{

System.out.print(str_a.charAt(i));

}

}

In this program, both the inputs ie. a sentence or line of text as well as the index position is obtained. A method is written to find the string at that particular position. Finally the method prints that character at the particular index.

You might be interested in
Please help I will mark brainliest ⚡️⚡️⚡️⚡️
Trava [24]

Answer:

school hours!

Explanation:

8 0
3 years ago
What is software engineering? What are the objectives of software engineering?
Mashutka [201]

Answer:

The basic objective of software engineering is to develop methods and procedures for software development that can scale up for large systems and that can be used consistently to produce high-quality software at low cost and with a small cycle of time.

Explanation:

7 0
2 years ago
How to fix Please enable JS and disable any ad blocker
Ira Lisetskai [31]

Answer:

im actually not sure

Explanation:

7 0
3 years ago
Read 2 more answers
The ________ contains the central electronic components of the computer. select one:
Sati [7]
The motherboard contains the central electronic components of the computer.
6 0
3 years ago
If a wire has insulation that allows it to operate in a temperature of up to 194 degrees Fahrenheit, what temperature will the w
zzz [600]
(194°F-32)×5/9
= 90°C
therefore the answer is 90degrees Celcius
6 0
3 years ago
Other questions:
  • Assign to avg_owls the average owls per zoo. Print avg_owls as an integer. Sample output for inputs: 1 2 4 3
    7·1 answer
  • A multiplicative inverse of 3 modulo 5 is any integer a such that 3 a ≡ 1 (mod 5) , hence for some a ∈ Z5 .
    12·1 answer
  • How do i unblock website on my school computer
    7·2 answers
  • Which of the following components controls the opening and closing of the valves in an engine ?
    15·2 answers
  • when files on storage are scattered throughout different disks or different parts of a disk, what is it called
    10·1 answer
  • You are not sure if a certain word has an"e"at the end<br>​
    11·1 answer
  • Your friend has a great idea for a new app, and she shows you a document that outlines what the app will do. This document is an
    6·1 answer
  • Koi jinda hei kya hello​
    13·2 answers
  • A text that presents an event and describe what happens as a result is an example of what text structure
    6·1 answer
  • What are tasks performed by pascaline?​
    8·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!