In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-18 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/03 Report--
This article mainly shows you "what's the difference between scala and java". The content is simple and clear. I hope it can help you solve your doubts. Let the editor lead you to study and learn this article "what's the difference between scala and java".
Differences: 1, Java needs to display the use of return to return the value, while the return of scala is optional. 2. Class and method modifiers. Scala defaults to public,java and defaults to protected. 3. Java supports interfaces; scala does not support interfaces, but uses trait.
The operating environment of this tutorial: windows7 system, java8 version, DELL G3 computer.
Introduction to Scala
1. What is Scala
Scala is a multi-paradigm programming language, which is designed to integrate the features of object-oriented programming and functional programming. Scala runs on the Java platform (Java virtual machine) and is compatible with existing Java programs.
2. Why learn Scala?
1. Elegance: this is the first consideration for framework designers. The users of the framework are application development programmers, and the elegance of API directly affects the user experience.
two。 Speed: the Scala language is expressive, one line of code is worth Java, and the development speed is fast; Scala is statically compiled, so it is much faster than JRuby,Groovy.
3. Can integrate into the Hadoop ecosystem: Hadoop is now the de facto standard of big data, Spark is not to replace Hadoop, but to improve the Hadoop ecology. Most of the JVM language may think of Java, but the API made by Java is too ugly, or it takes too much effort to implement an elegant API.
Introduction to Java
1. What is Java?
Java is an object-oriented programming language, which not only absorbs the advantages of C++ language, but also abandons the concepts of multi-inheritance and pointers which are difficult to understand in C++, so Java language has two characteristics: powerful and easy to use. As the representative of static object-oriented programming language, Java language perfectly implements the object-oriented theory and allows programmers to carry out complex programming in an elegant way of thinking.
2. Why learn Java?
Java has the characteristics of simplicity, object-oriented, distributed, robust, security, platform independence and portability, multithreading, dynamic and so on. Java can write desktop applications, Web applications, distributed systems, embedded system applications and so on.
Table comparison between java and scala-the value returned by the javascala method Java needs to be displayed using return to return the value. Scala's return is optional, and the method call automatically returns the last evaluated expression. If scala uses return, you need to display the default values of the specified method's return value class and method modifier java default is protected.scala default is public default import class java default import java.lang package scala default import java.lang package, scala package, scala.Predef class. Interface java supports interface scala does not support interface interface and adopts trait (similar to abstract classes in Java). Class members and singleton objects java are made up of class members, and singleton objects need to be implemented by themselves. Scala language mechanism supports singleton objects and concomitant objects, companion classes. Accompanying classes and associated objects need to be used in a class file. When using accompanying objects, the system implicitly calls apply to generate an associated instance of the object.
These are all the contents of this article entitled "what's the difference between scala and java". Thank you for reading! I believe we all have a certain understanding, hope to share the content to help you, if you want to learn more knowledge, welcome to follow the industry information channel!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.