November 19, 2014

Learning java basics

Learning java basics

Try the following queries in Google and learn Java from abc…

  1. how to run java in cmd? “java helloworld”
  2. how to compile java code in cmd? “javac helloworld.java”
  3. how to clear screen in cmd with java

    public final static void clearCMDConsole()
    {
    try
    {
    final String os = System.getProperty("os.name");
    if (os.contains("Windows"))
    {
    Runtime.getRuntime().exec("cls");
    }
    else
    {
    Runtime.getRuntime().exec("clear");
    }
    }
    catch (final Exception e)
    {
    // Handle any exceptions.
    }
    }

  4. how to exit program in java
  5. how to read file in java on windows
  6. how to get input in java
  7. how to compare string in java
  8. how to search a string in java:
    boolean exists = line.contains(search_str);
  9. how to append string in file java
  10. how to check empty string in java
  11. add element to array java
  12. overwrite text file in java
  13. compare two strings in java

Download Sample File

Last updated: November 19, 2014