Restore
This commit is contained in:
10
Labs/Lab2/Lab2Part1/Question7/.classpath
Normal file
10
Labs/Lab2/Lab2Part1/Question7/.classpath
Normal file
@@ -0,0 +1,10 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<classpath>
|
||||
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER">
|
||||
<attributes>
|
||||
<attribute name="module" value="true"/>
|
||||
</attributes>
|
||||
</classpathentry>
|
||||
<classpathentry kind="src" path="src"/>
|
||||
<classpathentry kind="output" path="bin"/>
|
||||
</classpath>
|
||||
17
Labs/Lab2/Lab2Part1/Question7/.project
Normal file
17
Labs/Lab2/Lab2Part1/Question7/.project
Normal file
@@ -0,0 +1,17 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<projectDescription>
|
||||
<name>Question7</name>
|
||||
<comment></comment>
|
||||
<projects>
|
||||
</projects>
|
||||
<buildSpec>
|
||||
<buildCommand>
|
||||
<name>org.eclipse.jdt.core.javabuilder</name>
|
||||
<arguments>
|
||||
</arguments>
|
||||
</buildCommand>
|
||||
</buildSpec>
|
||||
<natures>
|
||||
<nature>org.eclipse.jdt.core.javanature</nature>
|
||||
</natures>
|
||||
</projectDescription>
|
||||
@@ -0,0 +1,2 @@
|
||||
eclipse.preferences.version=1
|
||||
encoding/<project>=UTF-8
|
||||
BIN
Labs/Lab2/Lab2Part1/Question7/bin/ReverseString.class
Normal file
BIN
Labs/Lab2/Lab2Part1/Question7/bin/ReverseString.class
Normal file
Binary file not shown.
18
Labs/Lab2/Lab2Part1/Question7/src/ReverseString.java
Normal file
18
Labs/Lab2/Lab2Part1/Question7/src/ReverseString.java
Normal file
@@ -0,0 +1,18 @@
|
||||
import java.util.Scanner;
|
||||
|
||||
public class ReverseString {
|
||||
|
||||
public static void main(String[] args) {
|
||||
System.out.print("Enter a string: ");
|
||||
try(Scanner input = new Scanner(System.in)){
|
||||
String str = input.nextLine();
|
||||
String res = "";
|
||||
for(int i = str.length() - 1; i >= 0; i--) {
|
||||
res = res + str.charAt(i);
|
||||
}
|
||||
System.out.println("The reverse of the string \"" + str + "\" is \"" + res + "\"");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user