X26: atFirst

Write a function in Java that implements the following logic: Given a string, return a string made of its first 2 chars. If the string length is less than 2, use '@' for the missing chars.

Your Answer:

x
 
1
public String atFirst(String str)
2
{
3
    
4
}
5

Feedback

Your feedback will appear here when you check your answer.