- First i create a new Scala File say Contact.scala which has one Scala class like this
class Contact{ var firstName ="" private var lastName = "" }
-
Then go to the directory that has Contact.Scala and compile it using
scalac Contact.scala
, The scala compiler will create .class files for every class in that .sclaa file in appropriate package. In my case i have only one class in my Contact.scala so it creates Contact.class -
Next use javap Contact and and i can see following output being generated on the command line
Compiled from "Person.scala" public class Contact extends java.lang.Object{ private java.lang.String firstName; private java.lang.String lastName; public java.lang.String firstName(); public void firstName_$eq(java.lang.String); private java.lang.String lastName(); private void lastName_$eq(java.lang.String); public Contact(); }
How Scala code gets compiled into Java
For last few days i am learning Scala + play framework. Since i have been using Java for long time now, one that always helps is to convert Scala code into Java Code and see what is going on under the hood. I follow these steps
Using AngularJs in Worklight/PhoneGap application
Angular.js is a JavaScript MVC framework, that makes development of HTML applications easy. I wanted to figure out how to use it for developing Worklight application so i followed these steps to build simple Hello AngularJs application
- First create a WorkLight application using WorkLight wizard, make sure that it works
- Next make changes in the index.html or entry page of your application to include angular.js from Google CDN and also add
<p>Hello {{'World'.length}}</p>
to test if AngularJs template is working
<!DOCTYPE HTML>
<html>
<head>
<meta charset="UTF-8">
<title>HelloWorld</title>
<meta name="viewport" content="width=device-width,
initial-scale=1.0, maximum-scale=1.0,
minimum-scale=1.0, user-scalable=0">
<link rel="shortcut icon" href="images/favicon.png">
<link rel="apple-touch-icon" href="images/apple-touch-icon.png">
<link rel="stylesheet" href="css/HelloWorld.css">
<script>window.$ = window.jQuery = WLJQ;</script>
</head>
<body id="content" style="display: none;" ng-app>
<h1>Hello Angularjs</h1>
<p>Hello {{'World'.length}}</p>
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.0.6/angular.min.js" />
<script src="js/initOptions.js"></script>
<script src="js/HelloWorld.js"></script>
<script src="js/messages.js"></script>
</body>
</html
After deployment you will notice that it prints Hello + length of 'world' which is 5 characters like this