Daily Dairy

Some Questions Related to Scala

I was given a presentation on programming language Scala. Here are some questions,I am confusing about Scala:

1. Scala is a extension of java ?
Scala is extension of Java. Both are JVM based languages. Java is compiled by using javac and scala is compiled by using scalac. You can call java from scala and scala from java. One of its basic similarity is both are object oriented languages. But scala is advance and it also a functional programming language.

2. What is the meaning of res eg : re0, res1 etc ?

If you do calculations in scala interpreter it shows the result by showing

scala > 3+4

res0 : Int = 7 (which means it displays result of adding two numbers of type Int).
scala>2+3

res1 : Int = 5 (which is the second result and gives output:5).
3. Make a program in scala ?

object Addint{

def main(args:Array[String])

{ println(“value is :” + addint(10+10) ) ;

}

def addint(a:Int,b:Int) : Int {

var sum : Int =0

sum=a+b;

return sum
}

}
Output – value is : 20

4. Why the name of class and object is same in scala ?

I still haven’t find the solution of that question if any one find please tell me.

5. Practical implementation of various public classes in scala ?

I am not use classes in scala. When I work on classes I will updated later

Thank You 🙂

Daily Dairy

Install FTP and Configure

FTP : The File Transfer Protocol is a standard network  protocol used to transfer computer files between client and server on a computer network. Install vsftpd using : $ sudo apt-get install vsftpd           After successfully installing FTP Configure  vsftpd : Lets edit the configuration of vsftpd.conf using : $  vim /etc/vsftpd.conf Change : anonymous_enable… Continue reading Install FTP and Configure

Daily Dairy

Login into Server Without Password

  Starting by executing the following command: $ ssh-keygen This above command is used for creating key. Press enter at every prompt linuxconfig.local$ ssh-keygen Generating public/private rsa key pair. Enter file in which to save the key (/home/user/.ssh/id_rsa): Enter passphrase (empty for no passphrase): Enter same passphrase again: Your identification has been saved in /home/user/.ssh/id_rsa.… Continue reading Login into Server Without Password