MainClass.java Source code

Java tutorial

Introduction

Here is the source code for MainClass.java

Source

/*
 * Output:
     
$45.67
    
 */

public class MainClass {
    public static void main(String args[]) {
        String s1 = "The total cost is $45.67";
        int i1 = s1.indexOf('$');
        String s2 = s1.substring(i1);
        System.out.println(s2);
    }
}