xxxxxxxxxx
import java.util.*;;
public class SumCosts {
public static void main(String[] args) {
Scanner input = new Scanner(System.in);
String sMoney = "";
Currency rand = new Currency("R", "ZAR", 100);
Money cSum = new Money("R0.00", rand);
while (sMoney != "D" && sMoney != "Done") {
System.out.println("Enter an amount or '[D]one' to quit:");
sMoney = input.next();
if (sMoney == "D" || sMoney == "Done"){ //I think the issue is here
break;
}
Money cMoney = new Money(sMoney, rand);
cSum = cSum.add(cMoney);
}
input.close();
String sFinal = cSum.toString();
System.out.print("Total: ");
System.out.print(sFinal);
}
}
xxxxxxxxxx
class SomeClass {
public static void main(string[] args) {
//calling the loop method
loop();
}
/*basicly calling the loop method in the loop method
* that is a way to get a nice stackoverflow
* your welcome
*/
public static void loop() {
loop();
}
}
//or
class SomeOtherClass {
public static void main(string[] args) {
//basicly a never ending loop that has no delay
while(true) {
Systen.out.println("stackoverflow");
}
}
}
//or
class SomeOtherOtherClass {
public static void main(string[] args) {
//basicly another never ending loop that has no delay
for (i = 1; i > 0; i++) {
Systen.out.println("stackoverflow again");
}
}
}
xxxxxxxxxx
public class RecordDialog extends AppCompatDialogFragment {
@NonNull
@Override
public Dialog onCreateDialog(@Nullable Bundle savedInstanceState) {
AlertDialog.Builder builder = new AlertDialog.Builder(getActivity());
builder.setTitle("Recording...")
.setIcon(R.drawable.ic_record)
.setPositiveButton ("Stop", new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
}
});
return builder.create();
}
xxxxxxxxxx
import java.util.*;;
public class SumCosts {
public static void main(String[] args) {
Scanner input = new Scanner(System.in);
String sMoney = "";
Currency rand = new Currency("R", "ZAR", 100);
Money cSum = new Money("R0.00", rand);
while (sMoney != "D" && sMoney != "Done") {
System.out.println("Enter an amount or '[D]one' to quit:");
sMoney = input.next();
if (sMoney == "D" || sMoney == "Done"){ //I think the issue is here
break; //As the if statement ignores the fact the new value is "D" or "Done"
}
Money cMoney = new Money(sMoney, rand);
cSum = cSum.add(cMoney);
}
input.close();
String sFinal = cSum.toString();
System.out.print("Total: ");
System.out.print(sFinal);
}
}
xxxxxxxxxx
class MyClass
{
private static final int PROTEINS = 0;
MyArray[] foo = new MyArray[PROTEINS];
}