Q:

What is the difference between .sc and .scala file?

I am learning scala and got know that we can save scala file using two extensions, that is my.sc and my.scala.
Here is the sample file which i created:
my.scala
object My {

  /** Our main function where the action happens */
  def main(args: Array[String]) {

    Logger.getLogger("org").setLevel(Level.ERROR)
    val sc = new SparkContext("local[*]", "my")
    val lines = sc.textFile("readme.tx")
    val results = lines.countByValue()

   }
}

my.sc
object My {

  val hello: String = "Hello World!"
  println(hello)
}

What is the difference between the two?
When to use sc file extension and when to use scala file extension?

A:

A .scala file is a regular Scala file, in order to be compiled and ran as a regular program. This is the mostra scala file that you will use
An .sc file is a worksheet,  a worksheet is a file that will be evaluated as you save, the result for each expression is shown in a column to the right of your IDE. Worksheets are like a REPL session. It is useful to test some code in a quick way, just as you can do run the REPL
Edit
Awesome explanation here
What is the difference between scala classes, scripts and worksheets in Intellij-idea?

