Hi all,
I am new to learning Java Programming language and am in my first year of engineering. i am writing a java program to create a new string taking first and last characters from two given strings. Here is my Code: here is the Code link
When I try to compile the code getting an error, can any one please help me in this?
I am new to learning Java Programming language and am in my first year of engineering. i am writing a java program to create a new string taking first and last characters from two given strings. Here is my Code: here is the Code link
Java:
import java.lang.*;
public class Exercise73 {
public static void main(String[] args)
{
String str1 = "Java";
String str2 = "";
int length1 = str2.length();
String result = "";
result += (str1.length() >= 1) ? str1.charAt(0) : '#';
result += (length2 >= 1) ? str2.charAt(length2-1) : '#';
System.out.println(result);
}
}
When I try to compile the code getting an error, can any one please help me in this?