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
laila [671]
2 years ago
8

Write a method that returns a String that is just the first and last character of the given string Your return value should be o

nly two characters long. You can assume that the given string will not be empty.​
Computers and Technology
1 answer:
QveST [7]2 years ago
7 0

Answer:

The method in Java is as follows:

public static String returnlen(String input){

   String output = ""+input.charAt(0)+input.charAt(input.length()-1);

   return output;

}

Explanation:

This defines the method

public static String returnlen(String input){

This concatenates the first and the last character of the input string

   String output = ""+input.charAt(0)+input.charAt(input.length()-1);

This returns the concatenated string

   return output;

}

You might be interested in
Write a program that reads a 4-bit binary number from the keyboard as a string and then converts it into decimal. For example, i
adell [148]

Answer:

import java.util.Scanner;

public class ss11{

       public static void main (String[]args) {

             Scanner keyboard = new Scanner (System.in)

             String a1, a2, a3, a4, a5;

              int i1, i2, i3, i4, i5;

              System.out.println("Enter a four bit binary number:");

               a1= keyboard.next();

               a2= a1.substring(0,1);

               a3= a1.substring(1,2);

               a4= a1.substring(2,3);

               a5= a1.substring(3,4);

                i1 = Integer.parseInt(a2);

                i2 = Integer.parseInt(a3);

                i3 = Integer.parseInt(a4);

                i4 = Integer.parseInt(a5);

                i1= i1 * 8;

                i2= i1 * 4;

                i3= i1 * 2;

                i4= i1 * 1;

                i5= i1+i2+i3+i4;

                System.out.println("The converted decimal number is: +i5);

}

}

Explanation:

7 0
3 years ago
What part of a resource record tells a server how long the record should remain in the cache?
V125BC [204]
Time-to-live or TTL <span>tells a server how long the record should remain in the cache.
TTL is a mechanism that limits the lifetime of data in a network or a computer and prevents data packets from circulating indefinitely.
</span><span>It also improves the caching and privacy of networks and computers.</span>
8 0
3 years ago
Advantages of python programming language
Sauron [17]

Answer:

Great starter programming language. Overall very powerful but for beginners the more advanced characteristics like GUIs are too complicated. This is coming from personal experience and after first experiencing programming through Python, Javascript is my new favorite.

Explanation:

a great video by code camp titled "Learn Python - Full Course for Beginners [Tutorial]" is a great starting point!

6 0
3 years ago
Where do you place the title tag in HTML​
makkiz [27]

Answer:

The title tag is basically your saved document

Save as and poof

High Hopes^^

Barry-

5 0
3 years ago
When creating a database, in which step do you add foreign keys to tables?
lana66690 [7]
Https://docs.microsoft.com/en-us/sql/relational-databases/tables/create-foreign-key-relationships 
8 0
3 years ago
Other questions:
  • If you quote an author from a website in a paper, it will be important to create a _____ in your writing to give them credit for
    7·2 answers
  • What program controls the hardware and software in a computer?
    10·1 answer
  • The administrators of Tiny College are so pleased with your design and implementation of their student registra- tion and tracki
    13·1 answer
  • Consider the following code segment.
    11·1 answer
  • What games do you play?<br><br><br> Be sure not to report any answers!
    5·1 answer
  • Describe a situation in which a robot may have to avoid an obstacle without coming to a complete stop before turning.
    10·2 answers
  • What are hard ware and software requirments in multimedia computer system
    5·1 answer
  • What is printed when the following code has been executed?
    9·1 answer
  • PLEASE HELP. Nobody has been helping me, i need to resolve this code issue for game design
    8·1 answer
  • Data becomes _______ when it is presented in a format that people can understand and use.
    12·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!