Samples

OakJava7 Samples

==================================================================================


       SAMPLE-A: - Introduction : Why Java/j2ee is not a secure Programming Language?

     What   is the   Difference  betweeen   Java(Jdk1.8)  and  Oakjava7 ?

Brief  about  OakJava7  Divisions   and Doubtful  Faqs:-

==================================================================================


 Write Brief  about  OakJava7  Divisions   and Doubtful  Faqs:-

   

About OakJava7 Divisions


OakJava7 is  divided  into  6 types


i) Scroll Server with OakJava7 (.web) and OakJava7 (.ojava7)


ii) Scroll Server with  Java/j2ee and Java (jdk1.8) compiler 


(Note: Here Oakjava7 compiler is not used,instead of that Jdk1.8 compiler is used

with ScrollServer.Because  Hibernate, Mybatics ,Java Spring are written in Jdk1.8 

Thats why Oakjava7 compiler is not match with java/j2ee frameworks

Hibernate, Mybatics ,Java Spring ,and EJB.

so Jdk1.8 versions and  next versions of  Jdk1.8 will not be

supported to be used with Oakjava7 compiler.

Here Jsp ,and Servlet will not work in Scroll Server.

but EJB and JMS will work with Jdk1.8. 

You can see the sample for hibernate in SAMPLES SECTION.

ie) In Oakjava7 google site.

(Sample-2: Topic: Write   a JAVA7.0 program  with Scroll Program,

here Jdk1.8 compiler is focused).

(We advice Java Spring should optimize the source code.So Java(jdk1.8) 

professionals are permited to be used with most popular server which is Scroll Server.

)


iii) Scroll Server with (.java7) with Oakjava7 (OAKJAVA7.0) compiler


iv) Machine Learning and  data Science with  UserFriendly frameworks (OJ7UA).


v) Oakjava7  Advanced Samples with  (.web) and  Oakjava7 Console Application.


vi) OakJava7  with Remote X Application (Advanced Application) ( Not released now).


Doubtful FAQS?


1) Can oakjava7 compiler work  with  Jdk1.8 and java/j2ee frameworks ?

No.


2) Can Oakjava7 compiler compile Jdk1.8 programs ?

No, It will not accept jdk1.8 and other jdk1.8 versions.


3) Is Oakjava7  is the competitor of Java/J2ee?

No , Oakjava7 business is very different when compared

to Oracle business.

4) Is oakjava7 work as a Standalone application?

Yes, it will work without the help of Java/J2ee applications.


5) Is OakJava7 a high security Programming Language?

Yes.

Difference between Java(Jdk1.8) and  Oakjava7 ?


Both Java and Oakjava7 is used in webapplication and

console application.But Java follows cloudcomputing

Oakjava7 follows Remote-X Application.Oakjava7 is

not used to create a software like VB.net and

Java Swing. Oakjava7 is used only with java frameworks like hibernate

and Mybatics, it is not used with Java Spring ,the reason is Java Spring code is

very bulk. This Java Spring web/ standalone application

is very slow when compare to Node.js,Oakjava7(JAVA7.0).

Oakjava7 is invented in Dotweb and java(jdk1.6).Java Spring

takes more time to develop a webapplication when compared to OakJava7,Node.js.

And Oakjava7 has Advanced datastructures when compare to Java(Jdk1.8).

eg) Pipe,Bag,etc.Remember OakJava7 is not the competitor for Java,C#,

python,etc. OakJava7 is an interactive programming language. Java is

not a interactive programming Language.Oakjava7 is used in MachineLearning,

Datascience,mobile application,and single page application.

It supports obfuscation, Code Security, and it is Learnable.

Oakjava7 follows attractive and beautiful Userfriendly framework

(.oj7ua).Oakjava7 follows Shortest  function Statements.OakJava7 is

focus on Code Security.Oakjava7 is used with WNOSQL Database which  

provides high security...Oakjava7 is a standalone programming

language.That is without help of any available java frameworks 

Oakjava7 will able to create  webapplication,etc.Oakjava7 is

a Pure OOPS Programming Language. And Java/j2ee is not a

Pure OOPS Programming Language.Oakjava7 saves  time and  cost

and OakJava7 is a highest securable programming language.

Oakjava7 will compile and run the Oakjava7 program

at the same time. but Java(Jdk1.8) can't do it.


Demerits  of  Java/j2ee  Programming Language

Why Java/j2ee is not a secure Programming Language?

What ever java programs we write ,it is compiled to

.class file. So when you use JAD Decompiler what ever

program user write will be  converted to the source

code. So Security completly fails in 

Java,Jdk1.8 , and all the JDk versions.


for example)

Write a Mysql program listing the values from emp table.

MySQLCon.java

import java.sql.*;  

class MysqlCon{  

public static void main(String args[]){  

try{  

Class.forName("com.mysql.jdbc.Driver");  

Connection con=DriverManager.getConnection(  

"jdbc:mysql://localhost:3306/wil","root","Dove12345");  

//here sonoo is database name, root is username and password  

Statement stmt=con.createStatement();  

ResultSet rs=stmt.executeQuery("select * from emp");  

while(rs.next())  

System.out.println(rs.getInt(1)+"  "+rs.getString(2)+"  "+rs.getString(3));  

con.close();  

}catch(Exception e){ System.out.println(e);}  

}  

}  



After that when you compile the java program using Jdk1.8 or any java compiler

it produces .class file. So  when  the  hacker use JAD decompiler


jad <filename>.class


It will generate a source code for java/j2ee  in the form of  MysqlCon.jad what ever user code it.

You can see the code  as given below....  

 

MysqlCon.jad


// Decompiled by Jad v1.5.8f. Copyright 2001 Pavel Kouznetsov.

// Jad home page: http://www.kpdus.com/jad.html

// Decompiler options: packimports(3) 

// Source File Name:   MysqlCon.java


import java.io.PrintStream;

import java.sql.*;


class MysqlCon

{


    MysqlCon()

    {

    }


    public static void main(String args[])

    {

        try

        {

            Class.forName("com.mysql.jdbc.Driver");

            Connection connection = DriverManager.getConnection("jdbc:mysql://localhost:3306/wil", "root", "Dove12345");

            Statement statement = connection.createStatement();

            for(ResultSet resultset = statement.executeQuery("select * from emp"); resultset.next(); System.out.println((new StringBuilder()).append(resultset.getInt(1)).append("  ").append(resultset.getString(2)).append("  ").append(resultset.getString(3)).toString()));

            connection.close();

        }

        catch(Exception exception)

        {

            System.out.println(exception);

        }

    }

}


Note:

So all db connections and business logic is know to the hacker.

So writing the java program is useless,and hacker can easily steal

the data. Not only in Java , even in all the frameworks of

Java/J2ee , EJB, Servlet,Jsp,JMS,hacker can easily take  the data,db connections.

 That's  Why  Java/j2ee  fails completly in security side...

That's why  a New Interactive  programming language ,highly securable , more Advanced,

 Userfriendly Programming  Language   which  come in to the picture.

Which   is known  as   OakJava7(JAVA7.0)  Programming Language, which  is  created   in

Dotweb3.0(Advanced Programming Language)  and  Java(Jdk1.6)   by Wilmix Jemin .J.

What   is  the   Expansion   of    OAKJAVA7(JAVA7.0)   Programming Language.

Expansion  of  JAVA7.0  is

J  stands  for Jemin   , A stands   for Advanced , V stands  for  Virtual , and  A  stands for

Application   , 7 -> stands  for   wise  Programming  Language.

Note: Developers must  know  the  difference  between  OakJava7   and Jdk1.8. Then only

You  can  easily  study about  Oakjava7 (JAVA7.0). 


==================================================================================

                            SAMPLE-1:  Write  a Scroll  Webapplication  to  perform   Autocomplete operations  

==================================================================================

Program-1:  Write  a Scroll  Webapplication  to  perform   Autocomplete operations  

 

autocomplete1.html

=================

 

 

<!doctype html>

<html lang="en">

<head>

  <meta charset="utf-8">

  <meta name="viewport" content="width=device-width, initial-scale=1">

  <title>jQuery UI Autocomplete - Default functionality</title>

  <link rel="stylesheet" href="//code.jquery.com/ui/1.12.1/themes/base/jquery-ui.css">

  <link rel="stylesheet" href="/resources/demos/style.css">

  <script src="https://code.jquery.com/jquery-1.12.4.js"></script>

  <script src="https://code.jquery.com/ui/1.12.1/jquery-ui.js"></script>

  <script>

  $( function() {

    var availableTags = 

 

 

 

SAMPLE-17:  To  perform  autocomplete  operation

=========

 

 

<WEB> //start  of  oakjava7 program

 

<PACK> Program12 //  create  namespace  as  Program12 so  that  we can  use  this  namespace  as  a  library  in another  oakjava7 program

{

  

    <CLASS> Prog //  <CLASS> represents  class  

   {

 

  

      public void main() //  C  type main

      {

 

 

 

HTML.displayhtml("autocomplete1.html"); //  now  your  declare  HTML.displayhtml to  load  autocomplete1.html

 

   <PRINTLN>("[");

   <PRINTLN>("'JWEB(JDollar)',");

   <PRINTLN>("'DOTWEB',");

   <PRINTLN>("'OAKJAVA7',");

   <PRINTLN>("'PHP',");

   <PRINTLN>("'PHYTHON',");

   <PRINTLN>("'C',");

   <PRINTLN>("'DOTNET',");

   <PRINTLN>("'JAVA',");

   <PRINTLN>("'GO',");

   <PRINTLN>("'Angularjs',");

   <PRINTLN>("'Android',");

   <PRINTLN>("'Bootstrap.js',");

   <PRINTLN>("'JavaScript'");

   <PRINTLN>("]");

 

//  add  the  data  values

 

 

 

HTML.displayhtml("autocomplete2.html");//  now  you declare  HTML.displayhtml to  load  autocomplete1.html

        

 

 

 

      }

   }

}

 

 

 

 

 

 

autocomplete2.html

=================

 

;

    $( "#tags" ).autocomplete({

      source: availableTags

    });

  } );

  </script>

</head>

<body>

 

<div class="ui-widget">

  <label for="tags">Tags: </label>

  <input id="tags">

</div>

 

 

</body>

</html>

 

Output



 ==========================================================================================

Sample-2:    Write   a JAVA7.0 program  with Scroll Program

============================================================================================

Sample-2:

  Write   a JAVA7.0 program  with Scroll Program

 

 

i) use Mysql in this case

 

ii) Add  employee details.

 

iii) View  employee  details.

 

iv)    list  the  employee details

 

v) delete the  particular employee details

 

use Hibernate  to achieve it.

==============================================================

5)  Write   a JAVA7.0 program  with Scroll Program  

 

 

i) use Mysql in this case

 

ii) Add  employee details.

 

iii) View  employee  details.

 

iv)    list  the  employee details

 

v) delete the  particular employee details

 

use Hibernate  to achieve it.

register.java7

 <JAVA7>


public <CLASS> register


<%


<MAIN>


 


<%


HTML.displayhtml("jregister.html");


%>

%>

 

 

jregister.html


<html>

  <head>

    <title>EMPLOYEE DETAILS</title>

   

  </head>

 

  <body class="fancy">

<form action="http://localhost:8090/Employeedetail.java7" method="post" >

 

<div id="pageContainer">

    

      <div id="pageContent">

 

        <div id="chaptersAccordion">

 

            <h2><a href="#chapter1">Enter your   Details</a></h2>

            <div>

             

 

<p>Enter  Your SNO: <input type="text" name="sno" size="25" /></p>

<p>Enter  the ENAME : <input type="text" name="ename" size="15" /></p>

<p>Enter your DESIGNATION : <input type="text" name="designation" size="15"/></p>

 

 

 

            </div>

 

 

<h2><a href="#chapter2">REGISTER</a></h2>

            <div>

              <input type="submit" name="Click">

<input type="reset" name="Clear">

            </div>

 

 

</form>

 

</body>

</html>


Employeedetail.java7

<JAVA7>


<IMPORT>  java.util.ArrayList;

<IMPORT> java.util.List; 

<IMPORT> java.util.Date;

<IMPORT> java.util.Iterator; 

 

<IMPORT> jxl.read.biff.BiffException;

<IMPORT>  java.io.*;

<IMPORT> org.hibernate.HibernateException; 

<IMPORT> org.hibernate.Session; 

<IMPORT> org.hibernate.Transaction;

<IMPORT> org.hibernate.SessionFactory;

<IMPORT> org.hibernate.cfg.Configuration;


public <CLASS> Employeedetail {

   private static SessionFactory factory; 

 <MAIN>  

 throws  BiffException,IOException,Exception

{

      <TRY>{

         factory <NEW> Configuration().configure().buildSessionFactory();

      }<CATCH> (Throwable ex) { 

         System.err.println("Failed to create sessionFactory object." + ex);

         throw new ExceptionInInitializerError(ex); 

      }

      Employeedetail ME <NEW> Employeedetail();





 


 ArrayList<String> arm1 <NEW> ArrayList<String>();


arm1.add("sno");

arm1.add("ename");arm1.add("designation");

arm1.add("!");


ArrayList <String>  armg=SPLITREQUEST.RESULT(arm1,"Employeedetailj7.dsn",3,1);


<PRINTLINE>(armg);


/* Add few employee records in database */

      String empID1 = ME.addEmployee(armg.get(0).toString(), armg.get(1).toString(), (armg.get(2).toString()));

     

      /* Update employee's records */

     

ME.updateEmployee(empID1, (armg.get(2).toString()+"up"));

 

      /* List down new list of the employees */

      ME.listEmployees();

      /* Delete an employee from the database */

ME.deleteEmployee(empID1);

     

     /* List down new list of the employees */

     ME.listEmployees();

   }

   /* Method to CREATE an employee in the database */

   public String addEmployee(String sno, String ename, String designation){

      Session session = factory.openSession();

      Transaction tx = null;

      String employeeID = null;

      <TRY>{

         tx = session.beginTransaction();

         Employee employee <NEW> Employee( sno, ename,  designation);

         employeeID = (String) session.save(employee); 

         tx.commit();

      }<CATCH> (HibernateException e) {

         if (tx!=null) tx.rollback();

         e.print<STACK>Trace(); 

      }<FINALLY> {

         session.close(); 

      }

      return ""+employeeID;

   }

   /* Method to  READ all the employees */

   public void listEmployees( ){

      Session session = factory.openSession();

      Transaction tx = null;

      <TRY>{

         tx = session.beginTransaction();

         List employees = session.createQuery("FROM Employee").list(); 

         for (Iterator iterator = 

                           employees.iterator(); iterator.hasNext();){

            Employee employee = (Employee) iterator.next(); 

            <PRINTLINE>("Name: " + employee.getename()); 

           <PRINTLINE>("  Designation: " + employee.getDesignation()); 

          <PRINTLINE>("  SNO: " + employee.getsno()); 

         }

         tx.commit();

      }<CATCH> (HibernateException e) {

         if (tx!=null) tx.rollback();

         e.print<STACK>Trace(); 

      } <FINALLY> {

         session.close(); 

      }

   }

   /* Method to UPDATE salary for an employee */

   public void updateEmployee(String empid, String Designation ){

      Session session = factory.openSession();

      Transaction tx = null;

      <TRY>{

         tx = session.beginTransaction();

         Employee employee = 

                    (Employee)session.get(Employee.<CLASS>, empid); 

         employee.setDesignation( Designation );

session.update(employee); 

         tx.commit();

      }<CATCH> (HibernateException e) {

         if (tx!=null) tx.rollback();

         e.print<STACK>Trace(); 

      } <FINALLY> {

         session.close(); 

      }

   }

   /* Method to DELETE an employee from the records */

   public void deleteEmployee(String EmployeeID){

      Session session = factory.openSession();

      Transaction tx = null;

      <TRY>


{

         tx = session.beginTransaction();

         Employee employee = 

                   (Employee)session.get(Employee.<CLASS>, EmployeeID); 

         session.delete(employee); 

         tx.commit();

      }<CATCH> (HibernateException e) {

         if (tx!=null) tx.rollback();

         e.print<STACK>Trace(); 

      } <FINALLY> {

         session.close(); 

      }

   }

}


Employee.hbm.xml

<?xml version="1.0"?>

<!DOCTYPE hibernate-mapping PUBLIC

    "-//Hibernate/Hibernate Mapping DTD 3.0//EN"

    "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">

<hibernate-mapping >

    <class name="Employee" table="employee">

              <id name="sno" type="string" column="sno" >

                <generator class="assigned"/>           

              </id>

               

      <property name="ename" column="ename" type="string"/>

      <property name="designation" column="designation" type="string"/>

              

    </class>

</hibernate-mapping>


Hibernate.cfg.xml

<!DOCTYPE hibernate-configuration PUBLIC

        "-//Hibernate/Hibernate Configuration DTD 3.0//EN"

        "http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd">

<hibernate-configuration>

    <session-factory>

        <!-- JDBC Database connection settings -->

        <property name="connection.driver_class">com.mysql.cj.jdbc.Driver</property>

<property name="connection.url">jdbc:mysql://localhost:3306/wil</property>

        <property name="connection.username">root</property>

        <property name="connection.password">sove123457</property>

        

        <!-- JDBC connection pool settings ... using built-in test pool -->

        <property name="connection.pool_size">1</property>

        <!-- Select our SQL dialect -->

        <property name="dialect">org.hibernate.dialect.MySQLDialect</property>

        <!-- Echo the SQL to stdout -->

        <property name="show_sql">true</property>

        <!-- Set the current session context -->

        <property name="current_session_context_class">thread</property>

        <!-- Drop and re-create the database schema on startup -->

        <property name="hbm2ddl.auto">update</property>

        <!-- dbcp connection pool configuration -->

        <property name="hibernate.dbcp.initialSize">5</property>

        <property name="hibernate.dbcp.maxTotal">20</property>

        <property name="hibernate.dbcp.maxIdle">10</property>

        <property name="hibernate.dbcp.minIdle">5</property>

        <property name="hibernate.dbcp.maxWaitMillis">-1</property>

<mapping resource="Employee.hbm.xml"/>

    </session-factory>

</hibernate-configuration>


Input

Output

In Oakjava7 ,Jdk1.8 (java)  professionals also be  permitted to use  Scrollserver with Mysql/Oracledb/Wnosql,  Jdk.18, Spring,and Hibernate.  So the  output  will be  deletion of  one record , list remaining   records, and  update  the  data.

============================================================================================


Sample :3 :  

a)To count no of words  in a  given  text

b)Write a  Java7.0 program to write  a character sam to out7.txt and  read the  file out7.txt  use java7.0 libraries to achieve it. 

==========================================================


Program-3

a)To count no of words  in a  given  text using java7.0 Libraries

 

countwords.java7

 

<JAVA7>

 

public <CLASS> countwords

 

<%

 

 

 

<MAIN>

 

 

 

<%

 

 

// <J7String>  is String keyword in java7. we assign  a  value to  String s

<J7String> s= "Hello how are u when will you come to our  office? is";

 

//Call the method  WordCount.wordcount and pass the String s  value

int count=WordCount.wordcount(s);

 

 

// Print the word count

<PRINTLINE>("Wordcount="+count);

%>

 

</JAVA7>


Output:

Wordcount=12

Note:  compile  using   javac7   countwords.java7

        Run  using   java7  countwords  will  get  the  above output. 

 

b) Write a  Java7.0 program to write  a character sam to out7.txt and  read the  file out7.txt   use java7.0 libraries to achieve it. 

<WEB>

<USE> file; //load  file  packages using java7.0 libraries

<PACK> Program8

{

  

    <CLASS> Prog

   {

        public void main()

{

      

            char[] data = new char[]{ 's', 'a', 'm' };

// write  a   character   sam  to out7.txt

JFileWriter.Write("out7.txt",data,"out1.txt","out2.txt","OAK",0,2);

//read  out7.txt

JFileReader.Read("out7.txt", 3);

}

      

   }

}

Note

Use java7tools.dll  in Java7 Properties  file

Output:

sam

=====================================================================================

Sample-4: Write java7.0 program to find  shortest path in  a  given matrix -maze

===================================================================================

Program-4

Write java7.0 program to find  shortest path in  a  given matrix -maze.

 

ShortestPath.java7


<JAVA7>

public <CLASS> ShortestPath

 

<%

 

       /*the below variables are the "INPUT" variables*/

 

       static int numrows=10;              static      int numcols=10;

 

       static int startrow=5;        static int startcol=3;

 

static int endrow=1;               static int endcol=6;

 

     

 

           static      int myMaze[][]={{1,1,1,1,1,1,1,1,1,1},  /*  1 = wall  */

 

                                                                   {1,0,0,1,0,0,0,1,0,1},  /*  0 = space */

 

                                                                   {1,0,1,1,1,0,1,1,0,1},

 

                                                                   {1,0,0,0,0,0,0,0,0,1},

 

                                                                   {1,0,1,0,1,1,0,1,1,1},

 

                                                                   {1,0,0,0,0,1,0,0,0,1},

 

                                                                   {1,0,1,1,1,0,0,1,1,1},

 

                                                                   {1,0,1,1,1,1,0,1,0,1},

 

                                                                   {1,0,0,0,0,1,0,0,0,1},

 

                                                                   {1,1,1,1,1,1,1,1,1,1}};

 

 

 

 

 

 

       /*these two variables keep track of the shortest path found so far*/

 

       static      int shortestpath[]=new int[numrows*numcols];

 

       static      int shortestlength;

 

 

 

          /*******************************************************************/

 

     

 

       boolean beenhere(int row, int col, int pathsofar[], int lengthsofar)<%

 

                /*this private boolean function tells if this spot (row,col) has

 

                  been visited before*/

 

                

 

                int x;

 

                int tarGET = row*numcols+col;  /*this comPUTation gives a unique

 

                                                                                                id to each maze square*/

 

 

 

                for (x=0;x<lengthsofar;x++)

 

                          if (pathsofar[x]==tarGET) return true;

 

 

 

                return false;

 

      %>

 

 

 

          /*******************************************************************/

 

     

 

       public void showmypath(int mypath[], int mylength)<%

 

                /*this function prints out the maze and the path traveled so

 

                  far.*/

 

 

 

                int r,c;

 

 

 

                for (r=0;r<numrows;r++)<%

 

                             for(c=0;c<numcols;c++)<%

 

                                   if (myMaze[r][c]==1)

 

                                                <PRINT>("|");                     /*  | for walls   */

 

                                   else if (r==startrow && c==startcol)

 

                                                <PRINT>("S");                     /*  S for start   */

 

                                   else if (r==endrow && c==endcol)

 

                                                <PRINT>("X");                     /*  X for exit   */

 

                                   else if (beenhere(r,c,mypath,mylength))

 

                                                <PRINT>("o");                     /*  o for traveled   */

 

                                  else

 

                                                <PRINT>(" ");                      /* empty space  */

 

                         %>

 

                             <PRINTLINE>("");

 

               %>

 

      %>

 

       /*******************************************************************/

 

       public void findpath(int row, int col, int pathsofar[], int lengthsofar)<%

 

                /*This is the recursive function that finds the paths.  When it

 

                          does find a valid path, it outPUTs it then stores it into

 

                          shortestpath if is is shorter that what is currently held*/

 

 

 

                /*These 3 statements are the termination conditions:

 

                             out of bounds,  wall, and previously visited, respectively*/

 

                if (row<0 || col<0 || row>=numrows || col>=numcols)

 

                          return;

 

                if (myMaze[row][col]==1) return ;

 

                   if (beenhere(row, col, pathsofar, lengthsofar)) return;

 

 

 

                int mypath[]=new int[lengthsofar+1];

 

 

 

                System.arraycopy(pathsofar, 0, mypath, 0, lengthsofar);

 

                          /*for local copy for proper backtracking*/

 

                                                                 

 

              

 

                   mypath[lengthsofar++]=row*numcols+col;  /*adds this square to

 

                                                                                                                             traveled path*/

 

 

 

                if (row==endrow && col==endcol)<%           

 

                          /*Reached the end, thus finding a valid path*/

 

 

 

                             <PRINTLINE>("Found path of length "+lengthsofar+"!:");

 

                          showmypath(mypath, lengthsofar);

 

 

 

                          if (lengthsofar<=shortestlength)<%/*New shortest path?*/

 

                                      shortestlength=lengthsofar;

 

                                      System.arraycopy(mypath, 0, shortestpath, 0, lengthsofar);

 

                                      <PRINTLINE>(" (New shortest path of length " + lengthsofar + ")");

 

                         %>

 

                             <PRINTLINE>("");

 

                          return;

 

               %>

 

 

 

                /*Below, recursively call to go to other squares*/

 

                findpath(row-1, col, mypath, lengthsofar);

 

                findpath(row, col-1, mypath, lengthsofar);

 

                findpath(row, col+1, mypath, lengthsofar);

 

                findpath(row+1, col, mypath, lengthsofar);

 

      %>

 

                        

 

          /*******************************************************************/

 

          <MAIN>

 

       <%

 

                /* The main function initializes appropriate variables,

 

                          outPUTs the initial maze, finds the path, and outPUTs it*/

 

 

 

                int r,c,x;                              /*various counters*/

 

                int pathsofar[];         /*Path to GET started with*/

 

                int lengthsofar;        /*length to GET started with*/

 

 

 

                ShortestPath daMaze=new ShortestPath();   /*the maze object*/

 

 

 

                pathsofar=new int[daMaze.numrows*daMaze.numcols];  /*for max size*/

 

              

 

                for (x=0;x<daMaze.numrows*daMaze.numcols;x++)<%

 

                             daMaze.shortestpath[x]=-1;  /* initializing the path arrays*/

 

                          pathsofar[x]=-1;

 

               %>

 

 

 

                /*initial lengths*/

 

                   daMaze.shortestlength=daMaze.numrows*daMaze.numcols+1;

 

                lengthsofar=0;

 

 

 

                   <PRINTLINE>("Here's the maze:");

 

                for (r=0;r<daMaze.numrows;r++)<%

 

                          for (c=0;c<daMaze.numcols;c++)<%

 

                                   if (r==startrow && c==startcol)            /*outPUTing the initial*/

 

                                                <PRINT>("S");                /* maze state*/

 

                                   else if (r==endrow && c==endcol)

 

                                                <PRINT>("x");

 

                                   else if (daMaze.myMaze[r][c]==0)

 

                                            <PRINT>(" ");

 

                                   else <PRINT>("|");

 

                         %>

 

                             <PRINTLINE>("");

 

               %>

 

 

 

                   <PRINTLINE>("");

 

                   <PRINTLINE>("Finding Paths...");

 

 

 

                daMaze.findpath(startrow, startcol, pathsofar, lengthsofar);

 

 

 

                   <PRINTLINE>("");

 

                <PRINTLINE>("The shortest path found was the following of length "+ daMaze.shortestlength);

 

                   daMaze.showmypath(daMaze.shortestpath, daMaze.shortestlength);

 

 

 

      %>

 

</JAVA7>


 

Output

D:\wilmix\ScrollServer\SCROLL\src> java7  ShortestPath

Here's the maze:

||||||||||

|  |  x| |

| ||| || |

|        |

| | || |||

|  S |   |

| |||  |||

| |||| | |

|    |   |

||||||||||

 

Finding Paths...

Found path of length 8!:

||||||||||

|  | oX| |

| |||o|| |

|  ooo   |

| |o|| |||

|  S |   |

| |||  |||

| |||| | |

|    |   |

||||||||||

 (New shortest path of length 8)

 

Found path of length 12!:

||||||||||

|  | oX| |

| |||o|| |

|ooooo   |

|o| || |||

|ooS |   |

| |||  |||

| |||| | |

|    |   |

||||||||||

 

 

The shortest path found was the following of length 8

||||||||||

|  | oX| |

| |||o|| |

|  ooo   |

| |o|| |||

|  S |   |

| |||  |||

| |||| | |

|    |   |

||||||||||

 

 ======================================================================================

Sample-5: Write a Java7.0  program     to  use bubble sort to sort a given list  of nos

=======================================================================================

Program-5

Write a Java7.0  program     to  use bubble sort to sort a given list  of nos

bubblesort.java7


<JAVA7>

public <CLASS> bubblesort

 

<%

 

 

 

static void Sort(int a[])

 

 

 

<%

 

int temp=0;

 

for (int i=0;i<a.length;i++)

 

<%

 

for (int j=(i+1);j<a.length;j++)

 

<%

 

if (a[i] > a[j])

 

<%

 

temp=a[i];

 

 

 

a[i]=a[j];

 

 

 

a[j]=temp;

 

%>

 

%>

 

 

 

%>

 

 

 

 

 

for(int i=0;i<a.length;i++)

 

 

 

<PRINTLINE>(a[i]);

 

 

 

 

 

%>

 

<MAIN>

 

 

 

<%

 

// <NEW>  is  equivalent  to = new  in java

int[] a <NEW> int[]{1,5,67,0,7,8,9,5,12,45,-1,6};

 

 

Sort(a);

 

 

 

%>

 

 

</JAVA7>



Output

-1

0

1

5

5

6

7

8

9

12

45

67

=============================================================================== 

Sample-6   :   Write  a  java7.0 program  to  use  WXML to create  a register form and display the  details in a table (use scroll server)

=======================================================================================

Program-6


Write  a  java7.0 program  to use  WXML to create  a register form and display the  details in a table (use scroll server).

forms.java7

 <JAVA7>


public <CLASS> forms {

  <MAIN>

{

<PRINTLINE>(""+WXML.wxmlparser("register.wml", 1,null,null,null));

}

</JAVA7>

register.wml

<WML>

<FORM TITLE='RegisterForm'  Method='post' Url='http://localhost:8090/form2.java7'

       color='green'  Tcolor='gold' Name = 'ADD Form'  GUICount='4'  Password='no' Space='yes'

            Type='submit'  fields='{name,city,add,idno}'

            GUI='text'  Names='' Input ='{ROWS,COLS}'/>

   

 

 

 

</WML>

 

form2.java7

 

<JAVA7>


<IMPORT>  <J7>.util.*;

<IMPORT> <J7>.sql.*;

<IMPORT> jxl.Cell;

<IMPORT> jxl.Sheet;

<IMPORT> jxl.Workbook;


<IMPORT> jxl.read.biff.BiffException;



<IMPORT> jxl.write.Number;

<IMPORT> jxl.write.WritableSheet;

<IMPORT> jxl.write.WritableWorkbook;

<IMPORT> jxl.write.WriteException;



<IMPORT>  Securitydb.*;









public   <CLASS>  form2


<%



<MAIN>  

throws  BiffException ,Exception

<%

 ArrayList<<J7String>> arm1<NEW>  ArrayList<<J7String>>();

arm1.add("name");

arm1.add("city");

arm1.add("add");

arm1.add("idno");

arm1.add("!");


ArrayList<<J7String>> armg=SPLITREQUEST.RESULT(arm1,"form2oj7.dsn",4,1);


<PRINTLINE>("<body bgcolor=white>");

<PRINTLINE>("<form>");

<PRINTLINE>("<table bgcolor=gold>");

<PRINTLINE>("<TH>  Name </TH>");

<PRINTLINE>("<TH> CITY </TH>");

<PRINTLINE>("<TH> Address </TH>");

<PRINTLINE>("<TH> IDNO </TH>");

<PRINTLINE>("<tr>");



for(int i=0;i<armg.size();i++)

<%


<PRINTLINE>("<td>"+armg.GET(i).to<J7String>().replace("%2C"," ").replace("+"," ")+"</td>");


%>

  

<PRINTLINE>("</tr>");



 

<PRINTLINE>("</table>");

<PRINTLINE>("</form>");


<PRINTLINE>("</body>");

<PRINTLINE>("</html>");

%>

</JAVA7>


Input

Output

 ==================================================================================

Sample-7:

Write  a   Java7.0 program to find  breadth,length,volume for  a  box and

 merge two outputs  using  JAVA7 collections.

 

=====================================================================================

 

Program-7

Write  a   Java7.0 program to find  breadth,length,volume for  a  box and

 merge two outputs  using  JAVA7 collections.

 

 

 

 

Program1.web

============

 

<WEB>

<USE> <OAKJAVA7>.IO;

<USE> CUTIL;

<PACK> BoxApplication

{

<CLASS> Box

{

private double length; // Length of a box

private double breadth; // Breadth of a box

private double height; // Height of a box

public void setLength( double len )

<%

length = len;

}

public void setBreadth( double bre )

<%

breadth = bre;

}

public void setHeight( double hei )

<%

height = hei;

}

public double getVolume()

<%

return length * breadth * height;

}

}

<CLASS> Boxtester

{

public void main()

{

Box Box1 <NEW> Box(); // Declare Box1 of type Box

Box Box2 <NEW> Box();

double volume;

// Declare Box2 of type Box

// box 1 specification

Box1.setLength(6.0);

Box1.setBreadth(7.0);

Box1.setHeight(5.0);

// box 2 specification

Box2.setLength(12.0);

Box2.setBreadth(13.0);

Box2.setHeight(10.0);

// volume of box 1

volume = Box1.getVolume();

<PRINTLN>("Volume of Box1 :" +volume);

// volume of box 2

volume = Box2.getVolume();

// <PRINTLN>("Volume of Box2 : {0}", volume);

// Console.ReadKey();

CUTIL.ArrayList x <NEW> CUTIL.ArrayList();

// test size

<PRINTLN>("Initial size is " + x.size());

// test isEmpty

if (x.isEmpty())

<PRINTLN>("The list is empty");

else <PRINTLN>("The list is not empty");

// put datafrom file Java7Model.model

x.add(0, Java7Collection.QUERY());

x.add(1, (6));

x.add(0, (1));

x.add(2, (4));

<PRINTLN>("List size is " + x.size());

// test toString

<PRINTLN>("The list is " + x);

//insert value into Java7Model.model

Java7Collection.InsertQUERY(x.ToString());

// test indexOf

int index = x.indexOf((4));

if (index < 0)

<PRINTLN>("4 not found");

else <PRINTLN>("The index of 4 is " + index);

index = x.indexOf((3));

if (index < 0)

<PRINTLN>("3 not found");

else <PRINTLN>("The index of 3 is " + index);

// test get

<PRINTLN>("Element at 0 is " + x.get(0));

<PRINTLN>("Element at 3 is " + x.get(3));

// test remove

<PRINTLN>(x.remove(1) + " removed");

<PRINTLN>("The list is " + x);

<PRINTLN>(x.remove(2) + " removed");

<PRINTLN>("The list is " + x);

if (x.isEmpty())

<PRINTLN>("The list is empty");

else <PRINTLN>("The list is not empty");

<PRINTLN>("List size is " + x.size());

}

}

}

 

Note:  in JAVA7.0 Properties file  use  Java7Collection.dll

Javac  Programs1.web  will  generates programs1.web.exe

 

Output

z:\Prog\OAKJAVA7>programs1.web.exe

Volume of Box1 :210

Initial size is 0

The list is empty

List size is 4

The list is [1, [2000], 4, 6]

Java 5

The index of 4 is 2

3 not found

Element at 0 is 1

Element at 3 is 6

[2000] removed

The list is [1, 4, 6]

6 removed

The list is [1, 4]

The list is not empty

List size is 2

====================================================================================

                   Sample-8 : Java7.0 FileManipulation  and Words Count in a String 

====================================================================================

Sample8: Write  a  JAVA7.0 Program  for  FileManipulation and count the  no  of  words in a  String and  write a  shortstatements for  that.  

===============================================================

<WEB>

<USE> fx;

 //load  file  packages using java7.0 libraries

<PACK> Program2file

{

  

    <CLASS> Prog

   {

        public void main()

{

      

                // copy  file contents  from one  file to  another file

            CopyFile.call("out7.txt", "out71.txt");

                  // create  a  directory  name  wilmix

            CreateDir.call("wilmix");

                  

               // Randomly write to file wilmix1.txt  with  data [iam going now] from location 11 

            FileRandomAccess.WriteFile("wilmix1.txt", "iam going now..", 11);

                   // Randomly read from file wilmix1.txt from  position 1 with size 10

            String sop = FileRandomAccess.ReadFile("wilmix1.txt", 1, 10);

// print the  file contents

<PRINTLN> ("RandomAccess=" + sop);

                 

                //Write to  file wilmix2.txt with  data -> weldone today 

            FileSequentialAccess.Write("wilmix2.txt", "weldone  today");

//Sequentilly Read from  file wilmix2.txt   

            <PRINTLN>("SequentialAccess=" + FileSequentialAccess.Read("wilmix2.txt"));

            <PRINTLN>("");

            <PRINTLN>("");

                 // Read  Directory  contents

            ReadDir.call("C:\\Users\\will\\source\\repos\\file\\bin");

            String sop1 = "wilmix  is  good";

               // count no of  words  in  a  given string sop1

            <PRINTLN>("Wordcount=" + WordCount.wordcount(sop1));

            Console.ReadKey();

}

      

   }

}

Note: Java7.0 Filemanipulation  statements  are  very  short...

and  use  Java7Lib.dll  in properties.txt file...

Output

======

Z:\Program\OAKJAVA7>filemanipulation

Write to File Sucessfullywilmix1.txt

RandomAccess=            iam going now..

Write to File SuccessFullywilmix2.txt

SequentialAccess= weldone  today

file56.txt

Java7Lib.dll

Java7Sorting.dll

java7sound.exe

java7sound.exe.config

java7sound.pdb

Java7Str.dll

java7tools.dll

matlib.dll

out1.txt

out2.txt

out7.txt

out71.txt

wilmix

wilmix.txt

wilmix1.txt

wilmix2.txt

Wordcount=3


======================================================================================

                                SAMPLE-9: JAVA7.0 String inbuild functions

=================================================================================


Sample-9 : Write Java7.0 String in build functions using  Java7.0  .web 

===============================================================

program and  use  only  Java7.0 shortest  statements  to  achieve  it:-

=============================================================

Programs2.web

==============

<WEB>

<USE> Java7String;

<PACK> ConsoleApp28

{

<CLASS> Java7Strings

    {

           public void main()

        {

            

//JAVA7String

                // To  count  no  of  alphabets  in  a  given  string

            String s = "flight name  is  7890";

            int c=CountAlphabet.call(s);

            <PRINTLN>("Alphabet count=" + c);

            String s1 = "flight7890";

                //check  whether the  given string  is  alphanumeric  or  not..

            Boolean t = Isalphanumeric.call(s1);

            <PRINTLN>("Alphanumeric or  not=" + t);

                   //check  whether the  given string  is  decimal  or  not..

            Boolean t1 = IsDecimal.call(s);

            <PRINTLN>("Decimal or  not=" + t1);

                      //check  whether the  given string  is  numeric  or  not..

            String s2 = "122121";

            Boolean t2 = IsNumeric.call(s2);

            <PRINTLN>("Numeric or  not=" + t2);

            String s3 = "now is not  a  Good time  ";

                    // convert the  string lowercase  to  uppercase and viceversa 

            <PRINTLN>("Convert to  upper/lowercase" + Swapcase.call(s3));

            String s4 = "now is not  a  Good time";

                  

                // capitalize  and  uncapitalize  the  string

            <PRINTLN>("Convert to  capitalize = " + Title.capitalize(s4));

            <PRINTLN>("Convert to  uncapitallize = " + Title.Uncapitalize(s4));

            String str = "file56.txt";

                   // To  count  the    frequency  of  the  word...

           <PRINTLN>("WordFreq= "+ WordFreq.call(str));

                            

                                    //encode the  url with the given  data..

            String url = "https://www.geeksforgeeks.org/?q=";

            <PRINTLN>("URL ENCODER= " + UrlEncode.call(url, "u@geeks for geeks").ToString());

            //-----------------------------

            Console.ReadKey();

 

        }

    }

}

Note:  You had  to  use  Java7Str.dll  in  a  java7.0  properties file. 

=====

Output:

=======

Alphabet count=12

Alphanumeric or  not=True

Decimal or  not=False

Numeric or  not=True

Convert to  upper/lowercaseNOW IS NOT  A  gOOD TIME

Convert to  capitalize = Now is not  a  Good time

Convert to  uncapitallize = now is not  a  Good time

WordFreq= {API=1, Note=4, Recompile=2, WordFreq=2, Xlint=2, a=1, deprecated=1, d

eprecation=1, details=2, for=2, java=2, operations=1, or=2, overrides=1, uncheck

ed=2, unsafe=1, uses=2, with=2}

URL without encoding :

https://www.geeksforgeeks.org/?q=u@geeks for geeks

URL ENCODER= https://www.geeksforgeeks.org/?q=u%40geeks+for+geeks

================================================================================================

                                           Sample-10: JAVA7.0 MathLib functions

=================================================================================================

Sample-10: Write  a   Java7.0 Program  with  Java7.0 Mathlib functions..

==============================================================================

Programs3.web

==============

<WEB>

//load  java7mathlib library

<USE> java7mathlib;

<PACK> ConsoleApp289

{

<CLASS> Java7mat

    {

           public void main()

        {

            

//JAVA7-MATLIB

            String a1 = "Mother In Law";

            //"Keep";

            String a2 = "Hitler Woman";

                //"Peek";

                         // check  if  given  two  strings  are  anagram or not

            <PRINTLN>("isAnagram=" + anagram.isAnagram(a1, a2));

                    // check  whether  the  given no is  armstrong number  or  not

            <PRINTLN>("ArmStrongnumber=" + ArmStrongnumber.call(407));

            int[] arr = { 10, 20, 20, 30, 30, 40, 50, 50 };

            int length = arr.Length;

                     // remove  duplicates  in an  array

            arr = java7mathlib.ArrayremoveDuplicates.removeDuplicateElements(arr, length);

            for (int i1 = 0; i1 < arr.Length; i1++)

                <PRINTLN>(arr[i1] + " ");

           

            int[] arr1 = { 2, 21, 3, 4, 10, 40, 31, 41, 101, 401 };

            int l = arr1.Length;

                  // search  a  number 401  from  a given  array  using binarysearch        

            int result = BinarySearch.Binarysearchel(arr1, 0, l - 1, 401);

            if (result == -1)

                <PRINTLN>("Element not present"); 

        else

                <PRINTLN>("Element found at index " + result);

                

                 // find factorial  of  3

            <PRINTLN>("Factorial= " + Factorial.call(3));

            <PRINTLN>("Fibnocai= ");

              // find fibnoccai  series up  to  5    

            Fibnocai.call(5);

            <PRINTLN>("Is EVEN OR ODD ");

                // check  whether  the  given  number  is  even  or  odd

            Isevenorodd.call(122);

                //  check whether the  given number  is  prime  or  not

            <PRINTLN>("Prime or not="+NOTIsPrime.call(32));

            int[] p = { 25, 11, 7, 75, 56 };

                 // largest  element  in a  given  array

            <PRINTLN>("Largest element array=" + LargestElementArray.call(p));

                // Smallest element  in  a   given  array

            <PRINTLN>("Smallest element array=" + SmallestElementArray.call(p));

                       //check  whether  the  given  year  is  leap   year or  not  using  Java7.0 library 

            <PRINTLN>("Does 2000 a leap year : " + LeapYear.doesLeapYear(2000));

                       //check  whether  the  given  year  is  leap   year or  not  without using  Java7.0 library 

            <PRINTLN>("Does 2020 a leap year : " + LeapYear.isLeapYear(2020));

             String strj = "JDollar";

            String strj1 = "aaa";

                   // list  palindromicsubstrings  for  a  given string "JDollar" 

            <PRINTLN>("Palindromicsubstrings ="+java7mathlib.PalindromicSubStrings.countPalindromicSubStrings(strj));

                //  To  count no of  palidrome substring for  a  given string "aaa"

            <PRINTLN>("Palindomesubstring="+PalindromeSubstring.countPS(strj1));

                  // To  list  Permutation  for  a  given string "abc"

            <PRINTLN>("Permutation=" + java7mathlib.Permutation.call("abc"));

                    // Recursion  for  number 5

            <PRINTLN>("Recursion=" + Recursion.call(5));

                  // To check  whether  the  given number  can  be  reversed  or  not  

            <PRINTLN>("Reverse no =" + Reversenumber.IsReverse(12321));

                        //  To search  an element  7 from  a  given array p

            <PRINTLN>("Search no =" + Search.linearSearch(p,7));

            int[] r6 = { 1, 2, 3, 4, 5 };

            int[] r7;

                   // Rotate the  array in  right  direction  by  3  times and  print  the  array

            r7= RotateRight.call(r6, 3);

            <PRINTLN>("Array after right rotation: ");

            for (int i7 = 0; i7 < r7.Length; i7++)

            {

                Console.Write(r7[i7] + " ");

            }

            Console.ReadKey();

 

        }

    }

}

Note:  You had  to  use  matlib.dll  in  a  java7.0  properties file. 

=====

This  given  above  are JAVA7.0 Buildin functions  but Java7.0 developers  should

write  remaining  functions  in their own program. 

Output:

======

isAnagram=True

ArmStrongnumber=True

10

20

30

40

50

0

0

0

Element found at index 9

Factorial= 6

Fibnocai=

1

1

2

3

5

8

Is EVEN OR ODD

Given number 122 is a Even number

Prime or not=False

Largest element array=75

Smallest element array=7

Does 2000 a leap year : True

Does 2020 a leap year : True

Palindromicsubstrings =[D, ll, r, a, o, l, J]

Palindomesubstring=3

Permutation=[abc, acb, bac, bca, cba, cab]

Recursion=120

Reverse no =True

Search no =2

Original array:

1 2 3 4 5

Array after right rotation:

3 4 5 1 2

===============================================================================================

                                                                 Sample-11:  Java7.0  Sorting   

=============================================================================================

Sample-11: Java7.0 Sorting

==========================

Write  a   Java7.0 Sorting  Programs in  more  detail using various  ways  of  sorting short  statement  apis... 

===========================================================================

Programs2.web

==============

<WEB>

<USE> Java7Sort;

<PACK> ConsoleApp289

{

<CLASS> Java7Sortingn

    {

           public void main()

        {

            

            //Java7  Sorting

//BubbleSort

int[] arrb ={3,60,35,2,45,320,5};

BubbleSort.SortASC(arrb);//sorting array elements using bubble sort in Ascending order 

               

<PRINTLN>("\n The Bubble sorted array in Ascending order is: \n");

            foreach (int i in arrb)

            {

                Console.Write(i + " ");

            }

            <PRINTLN>("");

 BubbleSort.SortDESC(arrb);//sorting array elements using bubble sort  in  Descending order

              

<PRINTLN>("\n The Bubble sorted array in Descending order is: \n");

            foreach (int i in arrb)

            {

                Console.Write(i + " ");

            }

            <PRINTLN>("");

            int[] arrs = { 1, 10, 2, 3, 1, 23, 45, 21 };

            int[] arrs1 = { 0, 10, 2, 8, 23, 1, 3, 45 };

            int ns = arrs.Length;

            int ns1= arrs1.Length;

            int i9;

            Boolean order = true;

               //Bitonic Sort a given  array  arrs

            BitonicSort.sort(arrs, ns, order);

            <PRINTLN>("Bitonic Sorted array: \n");

            for (i9 = 0; i9 < ns; i9++)

                <PRINTLN>(arrs[i9]);

                     //CocktailSort a given  array  arrs1

            CocktailSort.Cocktail(arrs1, ns1);

            <PRINTLN>("Cocktail Sorted array: \n");

            for (i9 = 0; i9 < ns1; i9++)

                <PRINTLN>(arrs1[i9]);

            int[] arrs2 = { 1, 9, 2, 4, 2, 10, 45, 3, 2 };

            int ns2 = arrs2.Length;

               //CycleSort a given  array  arrs2

            CycleSort.sort(arrs2, ns2);

            <PRINTLN>("Cyclic Sorted array: \n");

            for (i9 = 0; i9 < ns2; i9++)

                <PRINTLN>(arrs2[i9]);

            int [] arr3 = { 12, 11, 13, 5, 6, 7 };

                //CycleSort a given  array  arr3

            HeapSort.sort(arr3);

            int ns3 = arr3.Length;

            <PRINTLN>("Heap Sorted array: \n");

            for (i9 = 0; i9 < ns3; i9++)

                <PRINTLN>(arr3[i9]);

            int[] arr111 = { 9, 14, 3, 2, 43, 11, 58, 22 };

               //InsertionSort a given  array  arr111

            InsertionSort.insertionSort(arr111);

            <PRINTLN>("After Insertion Sort");

            foreach (int i in arr111)

            {

                Console.Write(i + " ");

            }

            int[] arr7 = { 12, 11, 13, 5, 6, 7 };

            <PRINTLN>("Given Array");

            MergeSort.printArray(arr7);

   <PRINTLN>("");

//MergeSort a given  array  arr7            

            MergeSort.sort(arr7, 0, arr7.Length - 1);

            <PRINTLN>("\n Merge Sorted array");

            MergeSort.printArray(arr7);

            foreach (int i in arr7)

            {

                Console.Write(i + " ");

            }

            int[] arrq = { 10, 7, 8, 9, 1, 5 };

            int nq = arrq.Length;

//QuickSort a given  array  arrq

            QuickSort.sort(arrq, 0, nq - 1);

            <PRINTLN>("");

            <PRINTLN>(" Quick sorted array");

            QuickSort.printArray(arrq);

            foreach (int i in arrq)

            {

                Console.Write(i + " ");

            }

            <PRINTLN>("");

            int[] ra = { 90, 23, 101, 45, 65, 23, 67, 89, 34, 23 };

//RadixSort a given  array  ra

            RadixSort.radix_sort(ra);

            <PRINTLN>("\n The Radix sorted array is: \n");

            foreach (int i in ra)

            {

                Console.Write(i + " ");

            }

            <PRINTLN>("");

            int[] arr1s = { 9, 14, 3, 2, 43, 11, 58, 22 };

//SelectionSort a given  array  arr1s

            SelectionSort.selectionSort(arr1s);//sorting array using selection sort  

            <PRINTLN>("\n The Selection sorted array is: \n");

            foreach (int i in arr1s)

            {

                Console.Write(i + " ");

            }

            <PRINTLN>("");

            int[] arrs22 = { 1, 9, 2, 4, 2, 10, 45, 3, 2 ,100,-1,0,1,500,1000};

            int num = arrs22.Length;

//ShellSort a given  array  arrs22

            ShellSort.shellsort(arrs22, num);

            <PRINTLN>("\n The Shell sorted array is: \n");

            foreach (int i in arrs22)

            {

                Console.Write(i + " ");

            }

            <PRINTLN>("");

            Console.ReadKey();

 

        }

    }

}

Note:

=====

You  had  to  include  Java7Sorting.dll  in  Java7.0 Properties file

OUTPUT:

=======

 The Bubble sorted array in Ascending order is:

2 3 5 35 45 60 320

 The Bubble sorted array in Descending order is:

320 60 45 35 5 3 2

Bitonic Sorted array:

1

1

2

3

10

21

23

45

Cocktail Sorted array:

0

1

2

3

8

10

23

45

Cyclic Sorted array:

1

2

2

2

3

4

9

10

45

Heap Sorted array:

5

6

7

11

12

13

After Insertion Sort

2 3 9 11 14 22 43 58 

Given Array

12 11 13 5 6 7

 Merge Sorted array

5 6 7 11 12 13

5 6 7 11 12 13

 Quick sorted array

1 5 7 8 9 10

1 5 7 8 9 10

 The Radix sorted array is:

23 23 23 34 45 65 67 89 90 101

 The Selection sorted array is:

2 3 9 11 14 22 43 58

 The Shell sorted array is:

-1 0 1 1 2 2 2 3 4 9 10 45 100 500 1000

 ================================================================================================

                                  SAMPLE-12: JAVA7SHELL  in Java7.0

 ================================================================================================

JAVA7SHELL

==========

Java7Shell  is  a shell prompt designed by wilmixjemin for  OakJava7(JAVA7.0)  which will work on  windows  platform.

It  is  used  to  execute  and  compile  Java7.0 programs  and (oakjava7) RunJava7 <filename.web>.exe programs.

You can  see  the  #help  to  see  the  commands  in  Java7Shell..And type JshellPad to  invoke

Java7Notepad. And type  help  for  reading  Java7.0 samples  in  a Java7shell itself.Just Double click  the Java7shell icon in  desktop  to  start  Java7Shell.

1) when  you  type help and  #help  in  Java7Shell prompt  you  can  see  the  Screenshot

given  below...

2) When  you  type  RunJava7 <filename>  you can  see the output of  Java7.0 .exe programs  which is  given below...

3) You  can  also  compile / Run  Java7.0 Programs   you can  see the output of  Java7.0 .java programs  which  is  given below...

4)When  you  type  JshellPad you  can  invoke Java7Notepad  and  can  use  it  further and you  can  see  the  Screenshot  which  is  given  below...

===========================================================================

                              Sample-13 :  Java7.0 FileManipulation -Part-2

===================================================================================

       Sample-13:Write  Java7.0 program  using Short Statements  for  FileManipulation

==================================================================================

Programs2.web

=============

<WEB>

<USE> fx;

<PACK> ConsoleApp289

{

<CLASS> Java7File

    {

           public void main()

        {

            

            //Print the detail  of  the  file wilmix.txt

            <PRINTLN>("Print the  detail  of  file  wilmix.txt");

            FileDetail.Print("wilmix.txt");

            <PRINTLN>("----------------------");

            <PRINTLN>("Write  a  String  and  Print charater by  character  from  a file wilmix2.txt  using FileStream");

            // write  the  String  'he  is studying mathematics' in  the file wilmix2.txt using FileStream

            FileStream.Write("wilmix2.txt", "he  is  studying  mathematics");

            // read  character  by  character   from  a   file  wilmix2.txt using FileStream

            for (int i=0;i< FileStream.Read("wilmix2.txt").size();i++)

            Console.Write("" + FileStream.Read("wilmix2.txt").get(i).ToString());

            <PRINTLN>("");

             <PRINTLN>("----------------------");

            

            <PRINTLN>("Write  a  String  and  Print charater by  character  from  a file wilmix3.txt using Buffered ");

            // write  the  String  'horse  is  going now. now  it  is  not  a  good  time' in  the file wilmix3.txt

            Buffered.Write("wilmix3.txt", "horse  is  going now. now  it  is  not  a  good  time");

            // 

            <PRINTLN>("" + Buffered.Read("wilmix3.txt"));

            <PRINTLN>("----------------------");

            //read  a  string  from  file  wilmix3.txt  and  split the  string to  tokens and  get  the  2nd token  from  the  string

            <PRINTLN>("read  a  string  from  file  wilmix3.txt  and  split the  string to  tokens and  get  the  2nd token  from  the  string");

            <PRINTLN>("" + StringTokens.Split("wilmix3.txt").get(1));

            Console.ReadKey();

 

        }

    }

}

Note:  

======

Use Java7Lib.dll  at  Java7.0 Properties  file  for   FileManipulation-part2....

Output

======

Print the  detail  of  file  wilmix.txt

File name :wilmix.txt

Path: wilmix.txt

Absolute path:D:\Program\Programs\OAKJAVA7\wilmix.txt

Parent:null

Exists :true

Is writeable:true

Is readabletrue

Is a directory:false

File Size in bytes 13824

----------------------

Write  a  String  and  Print character by  character  from  a file wilmix2.txt  u

sing FileStream

he  is  studying  mathematics

----------------------

Write  a  String  and  Print charater by  character  from  a file wilmix3.txt us

ing Buffered

Data is  written  Success in  to  file..wilmix3.txt

horse  is  going now. now  it  is  not  a  good  time

----------------------

read  a  string  from  file  wilmix3.txt  and  split the  string to  tokens and

 get  the  2nd token  from  the  string

is

=================================================================================================

                                            SAMPLE - 14    :  JAVA7.0  Threading 

=================================================================================================

a) Write  a    Java7.0 program   to  print  the  Thread  in  a  simultaneous manner...

===========================================================================

MultiThread.java7

==================

<JAVA7>

<CLASS> Custom<Thread> <--- <Thread><%

 Custom<Thread>(<J7String> name) <%

 <SUPER>(name);

 <START>;

%>

 public void <RUN> <%

 <TRY> <%

 for(int loop_index = 0; loop_index < 4; loop_index++) <%

 <PRINTLINE>((<Thread>.current<Thread>()).GETName()+ " thread here...");

 <Thread>.sleep(1000);

%>

%>

 <CATCH> (<J7.Interrupted> e) <% %>

 <PRINTLINE>((<Thread>.current<Thread>()).GETName() +" ending.");

%>

%>

<CLASS> Multi<Thread><%

   <MAIN> <%

 Custom<Thread> thread1 <NEW> Custom<Thread>("Firstpage");

 Custom<Thread> thread2 <NEW> Custom<Thread>("Secondpage");

 Custom<Thread> thread3 <NEW> Custom<Thread>("Thirdpage");

 Custom<Thread> thread4 <NEW> Custom<Thread>("Fourthpage");

 <TRY> <%

 for(int loop_index = 0; loop_index < 10; loop_index++)<%

 <PRINTLINE>((<Thread>.current<Thread>()).GETName()+ " thread here...");

 <Thread>.sleep(1000);

%>

%>

 <CATCH> (<J7.Interrupted> e) <%

%>

%>

</JAVA7> 


Output:

z:\Program\JAVA7> java7  MultiThread

Firstpage thread here...

Secondpage thread here...

Thirdpage thread here...

Fourthpage thread here...

main thread here...

Firstpage thread here...

Secondpage thread here...

main thread here...

Fourthpage thread here...

Thirdpage thread here...

Firstpage thread here...

Secondpage thread here...

Fourthpage thread here...

main thread here...

Thirdpage thread here...

Firstpage thread here...

Secondpage thread here...

Fourthpage thread here...

main thread here...

Thirdpage thread here...

Firstpage ending.

Secondpage ending.

main thread here...

Fourthpage ending.

Thirdpage ending.

main thread here...

main thread here...

main thread here...

main thread here...

main thread here...

=======================================================================================

b)  Write  a    Java7.0 program   to  avoid  dead lock  situation  in  thread....

=======================================================================================

ThreadSynchronization.java7

==========================


<JAVA7>

<CLASS> Custom<Thread> <--- <Thread><%

 Custom<Thread>(<J7String> name) <%

 <SUPER>(name);

 <START>;

%>

 public void <RUN> <%

 <TRY> <%

 for(int loop_index = 0; loop_index < 4; loop_index++) <%

 <PRINTLINE>((<Thread>.current<Thread>()).GETName()+ " thread here...");

 <Thread>.sleep(1000);

%>

%>

 <CATCH> (<J7.Interrupted> e) <% %>

 <PRINTLINE>((<Thread>.current<Thread>()).GETName() +" ending.");

%>

%>

<CLASS> Multi<Thread><%

   <MAIN> <%

 Custom<Thread> thread1 <NEW> Custom<Thread>("Firstpage");

 Custom<Thread> thread2 <NEW> Custom<Thread>("Secondpage");

 Custom<Thread> thread3 <NEW> Custom<Thread>("Thirdpage");

 Custom<Thread> thread4 <NEW> Custom<Thread>("Fourthpage");

 <TRY> <%

 for(int loop_index = 0; loop_index < 10; loop_index++)<%

 <PRINTLINE>((<Thread>.current<Thread>()).GETName()+ " thread here...");

 <Thread>.sleep(1000);

%>

%>

 <CATCH> (<J7.Interrupted> e) <%

%>

%>

</JAVA7> 



Output

z:\Program\OAKJAVA7> java7 ThreadSynchronization

5

10

15

20

25

30

35

40

45

50

200

400

600

800

1000

1200

1400

1600

1800

2000

===========================================================================

c)  Write  a    Java7.0->OAKJAVA7 program   to  print  the  Thread  in  a  simultaneous manner...

===========================================================================

Programs2.web

=============

<WEB>

<USE> System.Threading;

<PACK> ConsoleApp2893

{

<CLASS> Java7Multithread

    {

public static void ChildThread()

        {

            for (int i = 0; i < 10; i++)

            {

                <PRINTLN>("Child I thread starts" + i);

                Thread.Sleep(100);

            }

        }

        public static void ChildThread1()

        {

            for (int i = 0; i < 10; i++)

            {

                <PRINTLN>("Child II thread starts"+i);

                Thread.Sleep(100);

            }

        }

           public void main()

        {

            

    ThreadStart childref = new ThreadStart(ChildThread);

            <PRINTLN>("In Main: Creating the Child thread");

            Thread childThread = new Thread(childref);

            childThread.Start();

            ThreadStart childref1 = new ThreadStart(ChildThread1);

            Thread childThread1 = new Thread(childref1);

            childThread1.Start();

            Console.ReadKey();

 

        }

    }

}

Output:

======

In Main: Creating the Child thread

Child II thread starts0

Child I thread starts0

Child I thread starts1

Child II thread starts1

Child I thread starts2

Child II thread starts2

Child II thread starts3

Child I thread starts3

Child II thread starts4

Child I thread starts4

Child I thread starts5

Child II thread starts5

Child II thread starts6

Child I thread starts6

Child II thread starts7

Child I thread starts7

Child I thread starts8

Child II thread starts8

Child I thread starts9

Child II thread starts9

===========================================================================

           d)  Write  a    Java7.0-OAKJAVA7 program   to  avoid  dead lock  situation  in  thread....

===========================================================================

Programs2.web

=============

<WEB>

<USE> System.Threading;

<PACK> ConsoleApp28934

{

<CLASS> Threadsync

{

    public void ThreadPrint()

    {

// <IS>  is  nothing  but  this  keyword  equivalent  to  C# or  java

        lock (<IS>)

        {

            for (int i = 1; i <= 10; i++)

            {

                Thread.Sleep(100);

                <PRINTLN>(i);

            }

        }

    }

}

<CLASS> Java7Synchronizethread

    {

           public void main()

        {

            

    Threadsync p = new Threadsync();

        Thread t1 = new Thread(new ThreadStart(p.ThreadPrint));

        Thread t2 = new Thread(new ThreadStart(p.ThreadPrint));

        t1.Start();

        t2.Start();

Console.ReadKey();

 

        }

    }

}

OUTPUT

======

1

2

3

4

5

6

7

8

9

10

1

2

3

4

5

6

7

8

9

10

=========================================================================================              

                                         Sample-15 : Java7.0 OOPS and Java7.0 Exception           

=========================================================================================

Java7.0 OOPS and Java7.0 Exception 

===================================

Note:  For  Java7.0- Java oops follow corejava oops ,  i has left  a  choice for

the  developers  to  do  their own assignment related  to   Java7.0 - Java oops..

     

JAVA7.0 OOPS

==============

First  Part  of JAva7.0 oops  is  simillar  to  C# oops  for  Oakjava7 <filename>.web

and  Second  part  of Java7.0 opps  is  simillar  to  Core Java  ooops..

Java7.0 oops  is  designed  in such  a way   that   Java / C#  professionals  can

easily  follow  it. Due  to this  Java7.0  is  otherwise  known  as  Interactive  Programming

Language.

JAVA7.0 Exception

=================

JAVA7.0  Exception is  simillar  to  java  and  C#  exception.

Java7.0 Excpetion  is  designed  in such  a way   that   Java / C#  professionals  can

easily  follow  it. Due  to this  Java7.0  is  otherwise  known  as  Interactive  Programming

Language.

Now  I explain  a   samples related   to Java7.0-OakJava7.0 <filename.web> oops which  is  given  below..

Properties  in Java7.0

=======================

A property is like a combination of a variable and a method, and it has two methods: a get and a set method.

The Name property is associated with the name field. It is a good practice to use the same name for both the property and the private field, but with an uppercase first letter.

The get method returns the value of the variable name.

The set method assigns a value to the name variable. The value keyword represents the value we assign to the property.

Programs2.web

==============

<WEB>

<PACK> ConsoleApp28934

{

   

<CLASS> Person

{

  private string name; // field

  public string Name   // property

  {

    get { return name; }

    set { name = value; }

  }

}

<CLASS> Java7oops

    {

           public void main()

        {

            

 Person myObj = new Person();

    myObj.Name = "BRITO";

    <PRINTLN>(myObj.Name);

 

        }

    }

}

Output:

=======

BRITO

===========================================================================

Inheritance  in Java7.0

===========================

Inheritance  means  parent  class  inherits  the  properties  of  child  class

but  here  inheritance  can  be  achieved  by using  ":" operator.. 

Programs2.web

=============

<WEB>

<PACK> Inheritance

{

   

<CLASS> Vehicle  // base <CLASS> (parent) 

{

  public string brand = "Ford";  // Vehicle field

  public void sound()             // Vehicle method 

  {                    

    <PRINTLN>("ook, ook!");

  }

}

<CLASS> Car : Vehicle  // derived <CLASS> (child)

{

  public string modelName = "Mustang";  // Car field

}

<CLASS> Java7oops

    {

           public void main()

        {

            

  Car myCar = new Car();

    // Call the sound() method (From the Vehicle class) on the myCar object

    myCar.sound();

    // Display the value of the brand field (from the Vehicle class) and the value of the modelName from the Car class

    <PRINTLN>(myCar.brand + " " + myCar.modelName);

 

        }

    }

}

OUTPUT

=======

ook, ook!

Ford Mustang

=================================================================

Polymorphism in Java7.0

==========================

Polymorphism means "many forms", and it occurs when we have many classes that are related to each other by inheritance.

Polymorphism uses those methods to perform different tasks. This allows us to perform a single action in different ways.

Now we can create Pig and Dog objects and call the animalSound() method on both of them:

Programs2.web

==============

<WEB>

<PACK> Polymorphism

{

   

<CLASS> Animal  // Base <CLASS> (parent) 

{

  public void animalSound() 

  {

    <PRINTLN>("The animal makes a sound");

  }

}

<CLASS> Pig : Animal  // Derived <CLASS> (child) 

{

  public void animalSound() 

  {

    <PRINTLN>("The pig says: wee wee");

  }

}

<CLASS> Dog : Animal  // Derived <CLASS> (child) 

{

  public void animalSound() 

  {

    <PRINTLN>("The dog says: bow wow");

  }

}

<CLASS> Java7oops

    {

           public void main()

        {

            

 Animal myAnimal = new Animal();  // Create a Animal object

    Animal myPig = new Pig();  // Create a Pig object

    Animal myDog = new Dog();  // Create a Dog object

    myAnimal.animalSound();

    myPig.animalSound();

    myDog.animalSound();

 

        }

    }

}

Output:

=======

The animal makes a sound

The animal makes a sound

The animal makes a sound

===========================================================================

Java7.0 Abstraction

=====================

Abstaction  is  defined  as  process  of  hiding  all  internal  details   from  the   outside world

and  provide  only  functionality   to  the  user.

Abstraction  can be   achieved  by using  abstract keyword and  Abstract methods..

The abstract keyword is used for classes and methods:

Abstract class: is a restricted class that cannot be used to create objects (to access it, it must be inherited from another class).

Abstract method: can only be used in an abstract class, and it does not have a body. The body is provided by the derived class (inherited from). 

 

Programs2.web

==============

<WEB>

<PACK> ABSTRACTION

{

abstract <CLASS> Animal

{

  // Abstract method (does not have a body)

  public abstract void animalSound();

  // Regular method

  public void sleep()

  {

    <PRINTLN>("Zzz");

  }

}

// Derived <CLASS> (inherit from Animal)

<CLASS> Pig : Animal

{

  public override void animalSound()

  {

    // The body of animalSound() is provided here

    <PRINTLN>("The pig says: wee wee");

  }

}

<CLASS> Java7oops

    {

           public void main()

        {

            

Pig myPig = new Pig(); // Create a Pig object

    myPig.animalSound();  // Call the abstract method

    myPig.sleep();  // Call the regular method

 

        }

    }

}

Output:

=======

The pig says: wee wee

Zzz

===========================================================================

Interface in Java7.0

=======================

Java7.0  doesnot  support  multiple Inheritance but multiple Inheritance  can  be  achieved  

using  interface  in Java7.0. If  you  are  using  multiple interface  separate  the  interfaces  by

comma. eg)  Interface name is toys, Interface name  in  electronics

so  seperate the  two  interface  toys,electronics 

ie) <CLASS> Things : toys, electronics  in  your  Java7.0  Program.

Notes on Interfaces:

=====================

Like abstract classes, interfaces cannot be used to create objects (in the example above, it is not possible to create an "IAnimal" object in the Program class)

Interface methods do not have a body - the body is provided by the "implement" class

On implementation of an interface, you must override all of its methods

Interfaces can contain properties and methods, but not fields/variables

Interface members are by default abstract and public

An interface cannot contain a constructor (as it cannot be used to create objects)

 

Programs2.web

==============

<WEB>

<PACK> interfaceexample

{

// Interface

interface IAnimal 

{

  void animalSound(); // interface method (does not have a body)

}

// Pig "implements" the IAnimal interface

<CLASS> Pig : IAnimal 

{

  public void animalSound() 

  {

    // The body of animalSound() is provided here

    <PRINTLN>("The pig says: wee wee");

  }

}

<CLASS> Java7oops

    {

           public void main()

        {

            

Pig myPig = new Pig();  // Create a Pig object

    myPig.animalSound();

 

        }

    }

}

Output

=======

The pig says: wee wee

===========================================================================

Enumeration  in  Java7.0

=========================

An enum is a special "class" that represents a group of constants (unchangeable/read-only variables).

To create an enum, use the enum keyword (instead of class or interface), and separate the enum items with a comma.

Programs2.web

==============

<WEB>

<PACK> enumexample

{

// Interface

<CLASS> Program

{

  enum color

  {

    red,

    black,

    green

  }

           public void main()

        {

          

color myVar1 = color.red;

    <PRINTLN>(myVar1);

 

        }

    }

}

Output

======

red

===========================================================================

Exception  in Java7.0

=====================

Exception  is  an abnormal condition  that  arise  during  the  code   sequence  at  runtime.

It  can be  achieved  by  using   <TRY> and  <CATCH>  or <Finally> block.

<Finally>  block  is  not  mandaltory, it  is  optional.  

when  you  specify  <Finally> block statements in Java7.0 , if the exception  arise  or

not  the  <Finally> block statements  will be get  excecuted..  

Programs2.web

==============

<WEB>

<PACK> exceptionexample

{

<CLASS> Program

  {

  

           public void main()

        {

          

 <TRY>

      {

        int[] myNumbers = {15, 21, 123};

        <PRINTLN>(myNumbers[10]);

      }

      <CATCH> (Exception e)

      {

        <PRINTLN>("Error.... "+e);

      }  

     <Finally>

      {

        <PRINTLN>("The Finally block  is  executed...");

      } 

 

    }

 

        }

    }

Output:

=======

Error.... System.IndexOutOfRangeException: Index was outside the bounds of the 

array.

   at exceptionexample.Program.Main(String[] args)

The Finally block  is  executed...

===========================================================================

UserDefinedException in  Java7.0

==================================

The throw statement allows you to create a custom error.

The throw statement is used together with an exception class.

in this  eg)  Arithmetic Exception  is  indicated  by  keyword <Arithmetic> in Java7.0..

So  you  had  to create   throw  new  Exception in  your method for   creating

User defined  exception  in Java7.0.

Programs2.web

==============

<WEB>

<PACK> userdefinedexception

{

<CLASS> Program

  {

  

 static void checkAge(int age)

    {

      if (age < 18)

      {

        throw new <Arithmetic>("Access denied - You must be at least 30 years old.");

      }

      else

      {

        <PRINTLN>("Access granted - You are old enough!");

      }

    }

           public void main()

        {

          

       checkAge(20);

 

    }

 

        }

    }

Output:

=======

Access granted - You are old enough!

================================================================================================

                    SAMPLE -16 :  STEPS FOR  JAVA7.0 Program ,compile  and  execute it

=================================================================================================

What  are  the  steps  to  write OakJava7 <filename.web>  program

and  how  to  configure  it and  Compile and  run   Java7.0 -> <filename.web> program  ?

STEPS FOR  JAVA7.0 Program

==========================

Step-1:  Write  a  OakJava7 <fiename.web>  in  a  file <fiename.web>  at Oakjava7 directory..

======

example)

HelloWorld.web

<WEB> // Represents to  load  oakjava7  default System packages.

<PACK> Example // <PACK> means  namespace  in  C#  or package  in java

{

  

    <CLASS> Program // <CLASS> means  class keyword in java or  c#

   {

      public void main() // Main function  of  oakjava7 program

      {

 

//<PRINTLN> means  printing  the  string  "HELLO WORLD!  MY First Java7.0 Program"  at windows command or Java7Shell prompt..

<PRINTLN>("HELLO WORLD!  MY First Java7.0 Program");

  

 

      }

   }

}  

Step-2:  Create  a  Blank file  <filename.web.lib> , <filename.web.obj> in  Oakjava7/outputs directory.

when  you   used only with  Command Prompt.But  when  you  use  Java7ShellPrompt 

and  compile the  files  using  javac7 <filename>.web. Java7ShellPrompt  will provide  autoconfiguration and  generates  .exe  at  output  directory..After  that Java7ShellPrompt  command  javac7 <filename.web>  will automatically  copy   from  /oakjava7/outputs directory   to   /oakjava7  directory  with  filename.exe  and  now  it  is  prepared for  the  developers  to     Execute the  Program  in  Java7Shellprompt  using  RunJava7.

So  there  is  no need  for  manual  configuration  for  Java7ShellPrompt  , Java7ShellPrompt  will  take  care..  

Step-3:  For  Command prompt , open  the   command prompt

and  compile the  files  using  javac7 <filename>.web

it  will  generates  .exe  at  output  directory..

and  copy  that  <filename.web>.exe  in  Oakjava7 directory

and  execute  <filename.web>.exe  in  command prompt

or  Java7Shell prompt  you  will  get  the  output  as

given below...

 Output:

=======

HELLO WORLD!  MY First Java7.0 Program

=================================================================================================

                      SAMPLE -17 :  How to Debug a errors in Java7.0  using Java7ShellPrompt During  compile /Run time ?

=================================================================================================

How to Debug a errors in Java7.0  using Java7ShellPrompt During  compile /Run time ?

Compiletime Error

==================

a)  If  you not  created a  java7  file  but  compile using  javac7 <filename.java7> in  a Java7ShellPrompt.

It will  display  the  screen shot  as  shown  below..

b) But  if you  created a  java7 file  but  compile using  javac7  <filename.java7> in a  Java7ShellPrompt.

it  will not  show  any error  in Java7ShellPrompt. But  if  you compile  using  javac7 <filename.java>

results  in  error which  is  "SystemIndexOutOfRangeException". that means it will not accept  .java  extension.

it   will  accept only  .java7  extension .

c)  If  you not  created a  java7  file  but  compile using  javac7 <filename.web> in  a Java7ShellPrompt.

It will  display  the  screen shot  as  shown  below..

d)   But  if you  created a  java7 file  but  compile using  javac7 <filename.web> in a  Java7ShellPrompt.

it  will not  show  any error  in Java7ShellPrompt. but it will  display  the  screen shot  as  shown  below..

Runtime Error

=============

e)  If  you not  created a  java7  file    but  run using  java7 <filename> in  a Java7ShellPrompt.

It will  display  the  screen shot  as  shown  below..

f) If  you   created a  java7  file and  compile without no error and if  there  is  runtime  error occur. But When we run using  

java7 <filename>  in  a Java7ShellPrompt.It will  display  the  screen shot  as  shown  below..

g)  If  you not  created a  oakjava7(.web)  file and compile with error  and  run using  RunJava7 <filename> in  a Java7ShellPrompt.

it  will  display  a  message box  that  "System cannot  find the  file  specified" in  a  Java7ShellPrompt.

h) If  you   created a  java7  file and  compile without no error and if  there  is no runtime  error occour. But When we run using 

 java7 <filename>  in  a Java7ShellPrompt.It will  display  the  screen shot  as  shown  below..

i) If  you   created a  oakjava7(.web)  file and compile without error  and  run using  RunJava7 <filename> in  a Java7ShellPrompt.

it  will  display  the  screen shot  as  shown  below..

========================================================

                 Sample-18: Serialization  and  Deserialization  in  Java7.0

========================================================

Example  for  Serialization  and  Deserialization  in  Java7.0

========================================================

Serialization.java7

==================

// Java7.0 code for serialization and deserialization 

<JAVA7> 

// <J7.Serialize> is  Serializable in java  

<CLASS> Emp --> <J7.Serialize> <%

private static final long serialversionUID = 

129348938L; 

<J7.transient> int a; 

static int b; 

<J7String> name; 

int age; 


// Default constructor 

public Emp(<J7String> name, int age, int a, int b) 

<%

this.name = name; 

this.age = age; 

this.a = a; 

this.b = b; 

%> 


%> 


public <CLASS> Serialization 


<%

public static void Displaydata(Emp object1) 

<%


<PRINTLINE>("name = " + object1.name); 

<PRINTLINE>("age = " + object1.age); 

<PRINTLINE>("a = " + object1.a); 

<PRINTLINE>("b = " + object1.b); 

%> 


 <MAIN>

<%

Emp object <NEW> Emp("melvin", 29, 20, 1000); 

<J7String> filename = "data.txt"; 


// Serialization 

<TRY> <%


// Saving of object in a file 

FileOutPUTStream file <NEW> FileOutPUTStream 

(filename); 

<OBJECT>OutPUTStream out <NEW> <OBJECT>OutPUTStream 

(file); 


// Method for serialization of object 

out.write<OBJECT>(object); 


out.close(); 

file.close(); 


<PRINTLINE>("<OBJECT> has been serialized\n"

+ "Data before Deserialization."); 

Displaydata(object); 


// value of static variable changed 

object.b = 2000; 

%> 


<CATCH> (IOException ex) <%

<PRINTLINE>("IOException is caught"); 

%>


object = null; 


// Deserialization 

<TRY> <%


// Reading the object from a file 

FileInPUTStream file <NEW> FileInPUTStream 

(filename); 

<OBJECT>InPUTStream in <NEW> <OBJECT>InPUTStream 

(file); 


// Method for deserialization of object 

object = (Emp)in.read<OBJECT>(); 


in.close(); 

file.close(); 

<PRINTLINE>("<OBJECT> has been deserialized\n"

+ "Data after Deserialization."); 

Displaydata(object); 


%>


<CATCH> (IOException ex) <%

<PRINTLINE>("IOException is caught"); 

%>


<CATCH> (ClassNotFoundException ex) <%

<PRINTLINE>("ClassNotFoundException" + 

" is caught"); 

%>

%>

</JAVA7> 



Output

======

Object has been serialized

Data before Deserialization.

name = melvin

age = 29

a = 20

b = 1000

Object has been deserialized

Data after Deserialization.

name = melvin

age = 29

a = 0

b = 2000

========================================================

                   Sample -19 : Operator Overloading  in Java7.0

========================================================

Example  for Operator Overloading  in Java7.0

=============================================

 

Ie)  Creating  three  offices  with  length ,breadth and  height..and

after  that  find  the  volume of  office1,office2,office3..

operatorOverload.web

====================

<WEB>

<PACK> OperatorOverloadapp {

  <CLASS> OFFICE {

      private double length;   // Length of a OFFICE

      private double breadth;  // Breadth of a OFFICE

      private double height;   // Height of a OFFICE

      public double getVolume() {

         return length * breadth * height;

      }

      public void setLength( double len ) {

         length = len;

      }

      public void setBreadth( double bre ) {

         breadth = bre;

      }

      public void setHeight( double hei ) {

         height = hei;

      }

      

      // Overload + operator to add two OFFICE objects.

      public static OFFICE operator+ (OFFICE b, OFFICE c) {

         OFFICE OFFICE = new OFFICE();

         OFFICE.length = b.length + c.length;

         OFFICE.breadth = b.breadth + c.breadth;

         OFFICE.height = b.height + c.height;

         return OFFICE;

      }

   }

   <CLASS> Tester {

     

      public void main()

{

         OFFICE OFFICE1 = new OFFICE();   // Declare OFFICE1 of type OFFICE

         OFFICE OFFICE2 = new OFFICE();   // Declare OFFICE2 of type OFFICE

         OFFICE OFFICE3 = new OFFICE();   // Declare OFFICE3 of type OFFICE

         double volume = 0.0;    // Store the volume of a OFFICE here

         // OFFICE 1 specification

         OFFICE1.setLength(7.0);

         OFFICE1.setBreadth(50.0);

         OFFICE1.setHeight(15.0);

         // OFFICE 2 specification

         OFFICE2.setLength(12.0);

         OFFICE2.setBreadth(13.0);

         OFFICE2.setHeight(10.0);

         // volume of OFFICE 1

         volume = OFFICE1.getVolume();

        <PRINTLN>("Volume of OFFICE1 : {0}", volume);

         // volume of OFFICE 2

         volume = OFFICE2.getVolume();

        <PRINTLN>("Volume of OFFICE2 : {0}", volume);

         // Add two object as follows:

         OFFICE3 = OFFICE1 + OFFICE2;

         // volume of OFFICE 3

         volume = OFFICE3.getVolume();

        <PRINTLN>("Volume of OFFICE3 : {0}", volume);

         Console.ReadKey();

      }

   }

}

Output

======

Volume of OFFICE1 : 5250

Volume of OFFICE2 : 1560

Volume of OFFICE3 : 29925

=================================================================================================

==============================================================================================

                               Topic:     JAVA7  DataStructures

=============================================================================                                       

 Sample-20 :JAVA7 DTS- Chapter 1    : ArrayQueue ,Hashmap,Arraylist,ARRAYS

==============================================================================

Chapter-1:ArrayQueue ,Hashmap,Arraylist,ARRAYS DTS

so  write a  oakjava7(Java7.0) Program  Programs9.web  program  and   compile using  javac Programs9.web   it  will  generates  Programs9.exe and

rename  Programs9.exe  to JList1.exe.

Programs9.web

==============

<WEB>

<USE> CUTIL;

<PACK> java7dts

{

    <CLASS> roots

    {

       public void main()

        {

         

ArrayQueue DTS

===============

//Oakjava7 ArrayQueue with attractive syntax

<J7ARRAYQUEUE> q= new <J7ARRAYQUEUE> (3);

            // add a few elements

            q.put((1));

            q.put((2));

            q.put((3));

            q.put((4));

            // remove  the top most  2 elements.

            q.remove();

            q.remove();

            q.put((5));

            q.put((6));

            q.put((7));

            q.put((8));

            q.put((9));

            q.put((10));

            q.put((11));

            q.put((12));

            // delete all elements

            while (!q.isEmpty())

            {

               <PRINTLN>("Rear element is " + q.getRearElement());

               <PRINTLN>("Front element is " + q.getFrontElement());

               <PRINTLN>("Removed the element " + q.remove());

            }

HASHMAP

============

// Oakjava7  Hashmap attractive syntax

<J7HASHMAP> h1 = new <J7HASHMAP>(8);

 h1.put(null, null); 

 h1.put((80), null);

 h1.put((80), null);

       h1.put((80), (80));

      h1.put((40),(40));

      

      h1.put((80), (80));

      h1.put((40), (40));

      

      h1.display();

ARRAYLIST DTS

=============     

//OakJava7  ArrayList attractive syntax

<J7ARRAYLIST> ar  =  new  <J7ARRAYLIST>();

for (int i=0;i<20;i++)

ar.add(i,i);

 <PRINTLN>("Value="+ar);

ARRAYS DTS

=============

//OakJava7  Arrays attractive syntax

<J7ARRAYS>  u =  new  <J7ARRAYS>("Wilmix");

for (int i=10;i>0;i--)

u.add(""+i);

u.add(""+ar.ToString());

 <PRINTLN>("Value="+u.ret(5));

 <PRINTLN>("Value="+u.ret(11));

 

 

}

}

}

Explanation:

============

ArrayQueues:

---------------------

 ArrayQueue is  the  dts in Java7.0  can  expand that  you  can add  the  elements more by

using  put statements.Now  Q.remove(),Q.remove()  will remove the first two  elements

and after that  you add 5,6,7,8,9,10,11,12 by using  put statements..Where  Loop

while (!q.isEmpty()) will  check  whether  the  ArrayQueue  is empty  or  not.

If  empty it  will  exit  the  while loop and  where  q.getRearElement()

will list  the  bottom most element. and Where  q.getFrontElement() will list

the top most element.and q.remove() will remove  the  topmost element and soon.

After  the  while  loop get's  exited you  will see  ArrayQueue becomes empty.

You already knows about  hashmap and arraylist dts functionality.

so  i will  explain about ARRAYS DTS.

ARRAYS DTS

===========

Java7 DTS  are  loosely  coupled dts..

so  add  some  20  elements  in  arraylist

and  add  some  10 elements  to  ARRAYS

and  now  convert the  arraylist  to String format  using  ar.ToString()

and  add  it  to  ARRAYS  using  u.add(object) statement.

so  u.ret(5)  will  print  6 only.

u.ret(11)  will  print Arraylist String objects.

Difference  between  ARRAYS and array

==================================

i) Array is  of  fixed length and  ARRAYS is  of dynamic length.

ii) ARRAYS  are  used  to  add  any  type of datatype  but array is  used  to add  only particular datatype which you  had  declared  eg)  if Array  is  int datatype  will store only  integers..

iii)ARRAYS  can  return the value by using ret statement by  specifing the  index.Array  should  specify  dimension  array  eg)  a[9] will  return  tenth element.

==========================================================

OUTPUT

========

Z:\Programs\OAKJAVA7>JLISt1

Rear element is 12

Front element is 3

Removed the element 3

Rear element is 12

Front element is 4

Removed the element 4

Rear element is 12

Front element is 5

Removed the element 5

Rear element is 12

Front element is 6

Removed the element 6

Rear element is 12

Front element is 7

Removed the element 7

Rear element is 12

Front element is 8

Removed the element 8

Rear element is 12

Front element is 9

Removed the element 9

Rear element is 12

Front element is 10

Removed the element 10

Rear element is 12

Front element is 11

Removed the element 11

Rear element is 12

Front element is 12

Removed the element 12

null

null

null

80

40

80

40

null

Value=[0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19]

Value=6

Value=[0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19]

=============================================================================================                                     

                                 Sample-21 :JAVA7 DTS- Chapter 2 : Hashtable,HashSet,Vector


==============================================================================================

Programs9.web

=============

<WEB>

<USE> CUTIL;

<PACK> java7dts7

{

    <CLASS> java78

    {

       public void main()

        {

<PRINTLN>("===============================");         

 <PRINTLN>("HashTable  in  Java7.0");

// In HashTable When duplicate  keys  with  different  values say  a and  b are  inserted  , so  at  that  key  a  value  is  overriden by  b value..

// HashTable  Stores  the  value  by  using  Hashcode..

//Oakjava7  Hashtable with attractive syntax

            <J7HASHTABLE> h1 = new <J7HASHTABLE>(6);

            h1.put(1, 1); h1.put(2, 890);

            h1.put(3, 332);

            h1.put(0, 567);

            h1.put(4, 56);

            h1.put(4,78);

          

      <PRINTLN>("Hashcode=" + h1.GetHashCode());

            for (int i=0;i<h1.size();i++)

{

                <PRINTLN>("value="+ h1.get(i));

}

<PRINTLN>("===============================");

// HashSet  prevents  Duplicate  values  insertion  

            <PRINTLN> ("HashSet  in  Java7.0");

//Oakjava7  Hashset with attractive Syntax.

        <J7HASHSET> h = new <J7HASHSET>(11);

            h.add("ac");

           h.add(5);

           h.add(5);  

<PRINTLN> ("" + h.GET());

<PRINTLN>("===============================");

//Vector  implements  a  dynamic  array  that  can  grow  depending on depend.  

            <PRINTLN>("Vector in  Java7.0");

             CUTIL.LinearList x=  new  CUTIL.LinearListAsVector  ();

            // test size

            <PRINTLN>("Initial size is " + x.size());

            // test isEmpty

            if (x.isEmpty())

                <PRINTLN>("The list is empty");

            else <PRINTLN>("The list is not empty");

            // test put

            x.add(0, (2));

            x.add(1, (6));

            x.add(0, (1));

            x.add(2, (4));

            <PRINTLN>("List size is " + x.size());

            // test toString

            <PRINTLN>("The list is " + x);

            // test indexOf

            int index = x.indexOf((4));

            if (index < 0)

                <PRINTLN>("4 not found");

            else <PRINTLN>("The index of 4 is " + index);

            index = x.indexOf((3));

            if (index < 0)

                <PRINTLN>("3 not found");

            else <PRINTLN>("The index of 3 is " + index);

            // test get

            <PRINTLN>("Element at 0 is " + x.get(0));

            <PRINTLN>("Element at 3 is " + x.get(3));

            // test remove

            <PRINTLN>(x.remove(1) + " removed");

            <PRINTLN>("The list is " + x);

            <PRINTLN>(x.remove(2) + " removed");

            <PRINTLN>("The list is " + x);

            if (x.isEmpty())

                <PRINTLN>("The list is empty");

            else <PRINTLN>("The list is not empty");

            <PRINTLN>("List size is " + x.size());

<PRINTLN>("===============================");

  

      // this <J7READLN>  Syntax  in Oakjava7  is simillar to    Console.ReadKey();

       <J7READLN>;

}

}

}

Output:

=======

===============================

HashTable  in  Java7.0

Hashcode=46104728

value=567

value=1

value=890

value=332

value=78

===============================

HashSet  in  Java7.0

[ac, 5]

===============================

Vector in  Java7.0

Initial size is 0

The list is empty

List size is 4

The list is [1, 2, 4, 6]

The index of 4 is 2

3 not found

Element at 0 is 1

Element at 3 is 6

2 removed

The list is [1, 4, 6]

6 removed

The list is [1, 4]

The list is not empty

List size is 2

===============================

===============================================================

                      

                                  Sample-22 :JAVA7 DTS- Chapter 3:  Pointerlist,Stack,Queue

===============================================================================================

JAVA7 DTS- Chapter 3:Pointerlist,Stack,Queue

=============================================

What  is  the  use   of  Pointer List   in Java7.0 ?

POINTERLIST is  a Advanced concepts in Java7.0 used to  store string data  and  list data  .

Sample3.web

===========

<WEB>

<USE> CUTIL;

<PACK> java7dts7p3

{

    <CLASS> java78

    {

       public void main()

        {

 <PRINTLN>("===============================================");

            <PRINTLN>("POINTERLIST is  a Advanced concepts in Java7.0 used to  store string data  and  list data  ");

           <J7ARRAYLIST> ar = new <J7ARRAYLIST>();

            int c = 0;

            for (int i = 0; i < 100000; i += 100)

            {

                ar.add(c, i);

                c ++;

            }

            <J7ARRAYLIST> ar = new <J7ARRAYLIST>();

            int c1 = 0;

            for (int i = 0; i < 100000; i += 200)

            {

                ar1.add(c1, i);

                c1++;

            }

         //PointerList   in OakJava7  with Attractive Syntax.

   <J7POINTERLIST> p = new <J7POINTERLIST>("CLASS in A  SCHOOLL-Student Datas");

            p.add("12 CLASS A-Student Data");

            p.add(ar.ToString());

            p.add("12 CLASS B-Student Data");

            p.add(ar1.ToString());

            for (int i = 0; i < p.size(); i++)

                <PRINTLN>("" + p.get(i));

            // A stack in Java7.0 is a data structure used to store a collection of objects. Individual items can be added and stored in a stack using a push operation.

            // stack  is based  on LIFO policy

            <PRINTLN>("===============================================");

            <PRINTLN>("A STACK in Java7.0");

// J7Linked stack in Oakjava7  with attractive syntax

                       <J7LINKEDSTACK> s = new <J7LINKEDSTACK>();

            // add a few elements

            s.<PUSH> ((1));

            s.<PUSH>((2));

            s.<PUSH>((3));

            s.<PUSH>((4));

            // delete all elements

            while (NOTs.empty())

            {

                <PRINTLN>("Top element is " + s.peek());

                <PRINTLN>("Removed the element " + s.<POP>);

            }

            <PRINTLN>("===============================================");

            <PRINTLN>("A QUEUE in Java7.0");

            // A Queue in Java7.0 is a data structure used to store a collection of objects. Individual items can be added and stored in a stack using a put operation.

            // Queue  is based  on FIFO policy

//Oakjava7  LinkedQueue with     Attractive Syntax.

<J7LINKEDQUEUE> q =new  <J7LINKEDQUEUE> (3);

            // add a few elements

            q.put((1));

            q.put((2));

            q.put((3));

            q.put((4));

            // delete all elements

            while (NOTq.isEmpty())

            {

                <PRINTLN>("Rear element is " + q.getRearElement());

                <PRINTLN>("Front element is " + q.getFrontElement());

                <PRINTLN>("Removed the element " + q.remove());

            }

            <PRINTLN>("===============================================");

            <J7READLN>;

}

}

}

Output:

======

===============================================

POINTERLIST  a Advanced concepts in Java7.0 used to  store string data  and  list data  

CLASS in A  SCHOOLL-Student Datas

12 CLASS A-Student Data

[0, 100, 200, 300, 400, 500, 600, 700, 800, 900, 1000, 1100, 1200, 1300, 1400, 1500, 1600, 1700, 1800, 1900, 2000, 2100, 2200, 2300, 2400, 2500, 2600, 2700, 2800, 2900, 3000, 3100, 3200, 3300, 3400, 3500, 3600, 3700, 3800, 3900, 4000, 4100, 4200, 4300, 4400, 4500, 4600, 4700, 4800, 4900, 5000, 5100, 5200, 5300, 5400, 5500, 5600, 5700, 5800, 5900, 6000, 6100, 6200, 6300, 6400, 6500, 6600, 6700, 6800, 6900, 7000, 7100, 7200, 7300, 7400, 7500, 7600, 7700, 7800, 7900, 8000, 8100, 8200, 8300, 8400, 8500, 8600, 8700, 8800, 8900, 9000, 9100, 9200, 9300, 9400, 9500, 9600, 9700, 9800, 9900, 10000, 10100, 10200, 10300, 10400, 10500, 10600, 10700, 10800, 10900, 11000, 11100, 11200, 11300, 11400, 11500, 11600, 11700, 11800, 11900, 12000, 12100, 12200, 12300, 12400, 12500, 12600, 12700, 12800, 12900, 13000, 13100, 13200, 13300, 13400, 13500, 13600, 13700, 13800, 13900, 14000, 14100, 14200, 14300, 14400, 14500, 14600, 14700, 14800, 14900, 15000, 15100, 15200, 15300, 15400, 15500, 15600, 15700, 15800, 15900, 16000, 16100, 16200, 16300, 16400, 16500, 16600, 16700, 16800, 16900, 17000, 17100, 17200, 17300, 17400, 17500, 17600, 17700, 17800, 17900, 18000, 18100, 18200, 18300, 18400, 18500, 18600, 18700, 18800, 18900, 19000, 19100, 19200, 19300, 19400, 19500, 19600, 19700, 19800, 19900, 20000, 20100, 20200, 20300, 20400, 20500, 20600, 20700, 20800, 20900, 21000, 21100, 21200, 21300, 21400, 21500, 21600, 21700, 21800, 21900, 22000, 22100, 22200, 22300, 22400, 22500, 22600, 22700, 22800, 22900, 23000, 23100, 23200, 23300, 23400, 23500, 23600, 23700, 23800, 23900, 24000, 24100, 24200, 24300, 24400, 24500, 24600, 24700, 24800, 24900, 25000, 25100, 25200, 25300, 25400, 25500, 25600, 25700, 25800, 25900, 26000, 26100, 26200, 26300, 26400, 26500, 26600, 26700, 26800, 26900, 27000, 27100, 27200, 27300, 27400, 27500, 27600, 27700, 27800, 27900, 28000, 28100, 28200, 28300, 28400, 28500, 28600, 28700, 28800, 28900, 29000, 29100, 29200, 29300, 29400, 29500, 29600, 29700, 29800, 29900, 30000, 30100, 30200, 30300, 30400, 30500, 30600, 30700, 30800, 30900, 31000, 31100, 31200, 31300, 31400, 31500, 31600, 31700, 31800, 31900, 32000, 32100, 32200, 32300, 32400, 32500, 32600, 32700, 32800, 32900, 33000, 33100, 33200, 33300, 33400, 33500, 33600, 33700, 33800, 33900, 34000, 34100, 34200, 34300, 34400, 34500, 34600, 34700, 34800, 34900, 35000, 35100, 35200, 35300, 35400, 35500, 35600, 35700, 35800, 35900, 36000, 36100, 36200, 36300, 36400, 36500, 36600, 36700, 36800, 36900, 37000, 37100, 37200, 37300, 37400, 37500, 37600, 37700, 37800, 37900, 38000, 38100, 38200, 38300, 38400, 38500, 38600, 38700, 38800, 38900, 39000, 39100, 39200, 39300, 39400, 39500, 39600, 39700, 39800, 39900, 40000, 40100, 40200, 40300, 40400, 40500, 40600, 40700, 40800, 40900, 41000, 41100, 41200, 41300, 41400, 41500, 41600, 41700, 41800, 41900, 42000, 42100, 42200, 42300, 42400, 42500, 42600, 42700, 42800, 42900, 43000, 43100, 43200, 43300, 43400, 43500, 43600, 43700, 43800, 43900, 44000, 44100, 44200, 44300, 44400, 44500, 44600, 44700, 44800, 44900, 45000, 45100, 45200, 45300, 45400, 45500, 45600, 45700, 45800, 45900, 46000, 46100, 46200, 46300, 46400, 46500, 46600, 46700, 46800, 46900, 47000, 47100, 47200, 47300, 47400, 47500, 47600, 47700, 47800, 47900, 48000, 48100, 48200, 48300, 48400, 48500, 48600, 48700, 48800, 48900, 49000, 49100, 49200, 49300, 49400, 49500, 49600, 49700, 49800, 49900, 50000, 50100, 50200, 50300, 50400, 50500, 50600, 50700, 50800, 50900, 51000, 51100, 51200, 51300, 51400, 51500, 51600, 51700, 51800, 51900, 52000, 52100, 52200, 52300, 52400, 52500, 52600, 52700, 52800, 52900, 53000, 53100, 53200, 53300, 53400, 53500, 53600, 53700, 53800, 53900, 54000, 54100, 54200, 54300, 54400, 54500, 54600, 54700, 54800, 54900, 55000, 55100, 55200, 55300, 55400, 55500, 55600, 55700, 55800, 55900, 56000, 56100, 56200, 56300, 56400, 56500, 56600, 56700, 56800, 56900, 57000, 57100, 57200, 57300, 57400, 57500, 57600, 57700, 57800, 57900, 58000, 58100, 58200, 58300, 58400, 58500, 58600, 58700, 58800, 58900, 59000, 59100, 59200, 59300, 59400, 59500, 59600, 59700, 59800, 59900, 60000, 60100, 60200, 60300, 60400, 60500, 60600, 60700, 60800, 60900, 61000, 61100, 61200, 61300, 61400, 61500, 61600, 61700, 61800, 61900, 62000, 62100, 62200, 62300, 62400, 62500, 62600, 62700, 62800, 62900, 63000, 63100, 63200, 63300, 63400, 63500, 63600, 63700, 63800, 63900, 64000, 64100, 64200, 64300, 64400, 64500, 64600, 64700, 64800, 64900, 65000, 65100, 65200, 65300, 65400, 65500, 65600, 65700, 65800, 65900, 66000, 66100, 66200, 66300, 66400, 66500, 66600, 66700, 66800, 66900, 67000, 67100, 67200, 67300, 67400, 67500, 67600, 67700, 67800, 67900, 68000, 68100, 68200, 68300, 68400, 68500, 68600, 68700, 68800, 68900, 69000, 69100, 69200, 69300, 69400, 69500, 69600, 69700, 69800, 69900, 70000, 70100, 70200, 70300, 70400, 70500, 70600, 70700, 70800, 70900, 71000, 71100, 71200, 71300, 71400, 71500, 71600, 71700, 71800, 71900, 72000, 72100, 72200, 72300, 72400, 72500, 72600, 72700, 72800, 72900, 73000, 73100, 73200, 73300, 73400, 73500, 73600, 73700, 73800, 73900, 74000, 74100, 74200, 74300, 74400, 74500, 74600, 74700, 74800, 74900, 75000, 75100, 75200, 75300, 75400, 75500, 75600, 75700, 75800, 75900, 76000, 76100, 76200, 76300, 76400, 76500, 76600, 76700, 76800, 76900, 77000, 77100, 77200, 77300, 77400, 77500, 77600, 77700, 77800, 77900, 78000, 78100, 78200, 78300, 78400, 78500, 78600, 78700, 78800, 78900, 79000, 79100, 79200, 79300, 79400, 79500, 79600, 79700, 79800, 79900, 80000, 80100, 80200, 80300, 80400, 80500, 80600, 80700, 80800, 80900, 81000, 81100, 81200, 81300, 81400, 81500, 81600, 81700, 81800, 81900, 82000, 82100, 82200, 82300, 82400, 82500, 82600, 82700, 82800, 82900, 83000, 83100, 83200, 83300, 83400, 83500, 83600, 83700, 83800, 83900, 84000, 84100, 84200, 84300, 84400, 84500, 84600, 84700, 84800, 84900, 85000, 85100, 85200, 85300, 85400, 85500, 85600, 85700, 85800, 85900, 86000, 86100, 86200, 86300, 86400, 86500, 86600, 86700, 86800, 86900, 87000, 87100, 87200, 87300, 87400, 87500, 87600, 87700, 87800, 87900, 88000, 88100, 88200, 88300, 88400, 88500, 88600, 88700, 88800, 88900, 89000, 89100, 89200, 89300, 89400, 89500, 89600, 89700, 89800, 89900, 90000, 90100, 90200, 90300, 90400, 90500, 90600, 90700, 90800, 90900, 91000, 91100, 91200, 91300, 91400, 91500, 91600, 91700, 91800, 91900, 92000, 92100, 92200, 92300, 92400, 92500, 92600, 92700, 92800, 92900, 93000, 93100, 93200, 93300, 93400, 93500, 93600, 93700, 93800, 93900, 94000, 94100, 94200, 94300, 94400, 94500, 94600, 94700, 94800, 94900, 95000, 95100, 95200, 95300, 95400, 95500, 95600, 95700, 95800, 95900, 96000, 96100, 96200, 96300, 96400, 96500, 96600, 96700, 96800, 96900, 97000, 97100, 97200, 97300, 97400, 97500, 97600, 97700, 97800, 97900, 98000, 98100, 98200, 98300, 98400, 98500, 98600, 98700, 98800, 98900, 99000, 99100, 99200, 99300, 99400, 99500, 99600, 99700, 99800, 99900]

12 CLASS B-Student Data

[0, 200, 400, 600, 800, 1000, 1200, 1400, 1600, 1800, 2000, 2200, 2400, 2600, 2800, 3000, 3200, 3400, 3600, 3800, 4000, 4200, 4400, 4600, 4800, 5000, 5200, 5400, 5600, 5800, 6000, 6200, 6400, 6600, 6800, 7000, 7200, 7400, 7600, 7800, 8000, 8200, 8400, 8600, 8800, 9000, 9200, 9400, 9600, 9800, 10000, 10200, 10400, 10600, 10800, 11000, 11200, 11400, 11600, 11800, 12000, 12200, 12400, 12600, 12800, 13000, 13200, 13400, 13600, 13800, 14000, 14200, 14400, 14600, 14800, 15000, 15200, 15400, 15600, 15800, 16000, 16200, 16400, 16600, 16800, 17000, 17200, 17400, 17600, 17800, 18000, 18200, 18400, 18600, 18800, 19000, 19200, 19400, 19600, 19800, 20000, 20200, 20400, 20600, 20800, 21000, 21200, 21400, 21600, 21800, 22000, 22200, 22400, 22600, 22800, 23000, 23200, 23400, 23600, 23800, 24000, 24200, 24400, 24600, 24800, 25000, 25200, 25400, 25600, 25800, 26000, 26200, 26400, 26600, 26800, 27000, 27200, 27400, 27600, 27800, 28000, 28200, 28400, 28600, 28800, 29000, 29200, 29400, 29600, 29800, 30000, 30200, 30400, 30600, 30800, 31000, 31200, 31400, 31600, 31800, 32000, 32200, 32400, 32600, 32800, 33000, 33200, 33400, 33600, 33800, 34000, 34200, 34400, 34600, 34800, 35000, 35200, 35400, 35600, 35800, 36000, 36200, 36400, 36600, 36800, 37000, 37200, 37400, 37600, 37800, 38000, 38200, 38400, 38600, 38800, 39000, 39200, 39400, 39600, 39800, 40000, 40200, 40400, 40600, 40800, 41000, 41200, 41400, 41600, 41800, 42000, 42200, 42400, 42600, 42800, 43000, 43200, 43400, 43600, 43800, 44000, 44200, 44400, 44600, 44800, 45000, 45200, 45400, 45600, 45800, 46000, 46200, 46400, 46600, 46800, 47000, 47200, 47400, 47600, 47800, 48000, 48200, 48400, 48600, 48800, 49000, 49200, 49400, 49600, 49800, 50000, 50200, 50400, 50600, 50800, 51000, 51200, 51400, 51600, 51800, 52000, 52200, 52400, 52600, 52800, 53000, 53200, 53400, 53600, 53800, 54000, 54200, 54400, 54600, 54800, 55000, 55200, 55400, 55600, 55800, 56000, 56200, 56400, 56600, 56800, 57000, 57200, 57400, 57600, 57800, 58000, 58200, 58400, 58600, 58800, 59000, 59200, 59400, 59600, 59800, 60000, 60200, 60400, 60600, 60800, 61000, 61200, 61400, 61600, 61800, 62000, 62200, 62400, 62600, 62800, 63000, 63200, 63400, 63600, 63800, 64000, 64200, 64400, 64600, 64800, 65000, 65200, 65400, 65600, 65800, 66000, 66200, 66400, 66600, 66800, 67000, 67200, 67400, 67600, 67800, 68000, 68200, 68400, 68600, 68800, 69000, 69200, 69400, 69600, 69800, 70000, 70200, 70400, 70600, 70800, 71000, 71200, 71400, 71600, 71800, 72000, 72200, 72400, 72600, 72800, 73000, 73200, 73400, 73600, 73800, 74000, 74200, 74400, 74600, 74800, 75000, 75200, 75400, 75600, 75800, 76000, 76200, 76400, 76600, 76800, 77000, 77200, 77400, 77600, 77800, 78000, 78200, 78400, 78600, 78800, 79000, 79200, 79400, 79600, 79800, 80000, 80200, 80400, 80600, 80800, 81000, 81200, 81400, 81600, 81800, 82000, 82200, 82400, 82600, 82800, 83000, 83200, 83400, 83600, 83800, 84000, 84200, 84400, 84600, 84800, 85000, 85200, 85400, 85600, 85800, 86000, 86200, 86400, 86600, 86800, 87000, 87200, 87400, 87600, 87800, 88000, 88200, 88400, 88600, 88800, 89000, 89200, 89400, 89600, 89800, 90000, 90200, 90400, 90600, 90800, 91000, 91200, 91400, 91600, 91800, 92000, 92200, 92400, 92600, 92800, 93000, 93200, 93400, 93600, 93800, 94000, 94200, 94400, 94600, 94800, 95000, 95200, 95400, 95600, 95800, 96000, 96200, 96400, 96600, 96800, 97000, 97200, 97400, 97600, 97800, 98000, 98200, 98400, 98600, 98800, 99000, 99200, 99400, 99600, 99800]

===============================================

A STACK in Java7.0

Top element is 4

Removed the element 4

Top element is 3

Removed the element 3

Top element is 2

Removed the element 2

Top element is 1

Removed the element 1

===============================================

A QUEUE in Java7.0

Rear element is 4

Front element is 1

Removed the element 1

Rear element is 4

Front element is 2

Removed the element 2

Rear element is 4

Front element is 3

Removed the element 3

Rear element is 4

Front element is 4

Removed the element 4

===========================================================================

                   

                        Sample-23 :JAVA7 DTS- Chapter 4:  TreeSet ,TreeMap ,Dictionary

==========================================================================

Sample-23 :JAVA7 DTS- Chapter 4:  TreeSet,TreeMap,Dictionary

======================================================

sample25.web

============

<WEB>

//load  oakjava7 util package

<USE>  <OJ7UTIL>;

<PACK> java7dts

{

    <CLASS> roots

    {

       public void main()

        {

         

     

 

// tree set

<PRINTLN>("-------------------------------------------------------");

<PRINTLN>("               TREESET                                   ");

<PRINTLN>("-------------------------------------------------------");

TreeSet ts = new TreeSet();

            ts.add("kkks");

            ts.add("For");

            ts.add("kkkk");

            ts.add("A");

            ts.add("B");

            ts.add("Z");

            <PRINTLN>("Initial TreeSet " + ts);

            // Removing the element b 

            ts.remove("B");

            <PRINTLN>("After removing element " + ts);

            // Removing the first element 

            ts.pollFirst();

            <PRINTLN>("After removing first " + ts);

            // Removing the last element 

            ts.pollLast();

            <PRINTLN>("After removing last " + ts);

 

 

//treemap

<PRINTLN>("-------------------------------------------------------");

<PRINTLN>("               TREEMAP                                   ");

<PRINTLN>("-------------------------------------------------------");

TreeMap tm1 = new TreeMap();

            // Initialization of a TreeMap 

            

            TreeMap tm2

                = new TreeMap();

            // Inserting the Elements 

            tm1.put(3, "fgkj");

            tm1.put(2, "For");

            tm1.put(1, "fgkjs");

            tm2.put(3, "fgkjs");

            tm2.put(2, "For");

            tm2.put(1, "fgkjs");

            <PRINTLN>(tm1);

            tm2.put(2, "Foreach");

           <PRINTLN>(tm2);

<PRINTLN>("-------------------------------------------------------");

<PRINTLN>("               Dictionary                                   ");

<PRINTLN>("-------------------------------------------------------");

Dictionary mp = new Hashtable();

            // put() method 

            mp.put("279", "maths");

            mp.put("56", "science");

            // elements() method : 

            for (Enumeration i = mp.elements(); i.hasMoreElements();)

            {

                <PRINTLN>("Value in Dictionary : " + i.nextElement());

            }

            // get() method : 

            <PRINTLN>("\nValue at key = 6 : " + mp.get("6"));

            <PRINTLN>("Value at key = 279 : " + mp.get("279"));

            // isEmpty() method : 

            <PRINTLN>("\nThere is no key-value pair : " + mp.isEmpty() + "\n");

            // keys() method : 

            for (Enumeration k = mp.keys(); k.hasMoreElements();)

            {

                <PRINTLN>("Keys in Dictionary : " + k.nextElement());

            }

            // remove() method : 

            <PRINTLN>("\nRemove : " + mp.remove("279"));

            <PRINTLN>("Check the value of removed key : " + mp.get("279"));

            <PRINTLN>("\nSize of Dictionary : " + mp.size());

}

}

}

Output

=======

-------------------------------------------------------

               TREESET                                   

-------------------------------------------------------

Initial TreeSet [A, B, For, Z, kkkk, kkks]

After removing element [A, For, Z, kkkk, kkks]

After removing firstElement [For, Z, kkkk, kkks]

After removing lastElement [For, Z, kkkk]

-------------------------------------------------------

               TREEMAP                                   

-------------------------------------------------------

{1=fgkjs, 2=For, 3=fgkj}

{1=fgkjs, 2=Foreach, 3=fgkjs}

-------------------------------------------------------

               Dictionary                                   

-------------------------------------------------------

Value in Dictionary : maths

Value in Dictionary : science

Value at key = 6 : 

Value at key = 279 : maths

There is no key-value pair : False

Keys in Dictionary : 279

Keys in Dictionary : 56

Remove : maths

Check the value of removed key : 

Size of Dictionary : 1

==============================================================================================

                                                               Sample -24 : OakJava7 Memory Management

==============================================================================================



OakJava7 Memory Management

===========================


This  OakJava7 Memory Management  has  Stack and  Heap datastructure included.

Stack is  used  to store  the values and  heap datastructure  is  used

to  store the  objects.

for  eg)  If  a  person  want  to  take  1  crore values from wnosql db.

and  display  the  values  in  console or webpage. 

This  make  the webpage or console very slow.

This  is solved by using OakJava7 Memory management (OMM).

This OMM  allow only one collection framework at a time.

example: ArrayList.



Write a OakJava7 program to  store 10 lakh customer data 

and another employee data in ArrayList and

store customer and  employee ArrayList  in

Java7 heap  and Print customer and  employee data 

at  console?



jmemlist.web

============


<WEB>


<PACK> jem

{

<CLASS> J7Files

    {

           public void main()

        {


    

 

 <OJ7UTIL>.ArrayList  ar <NEW> <OJ7UTIL>.ArrayList (1000000);

 <OJ7UTIL>.ArrayList  ar11 <NEW>   <OJ7UTIL>.ArrayList (1000000);


for (int i=0; i<1000000;i++)


ar.add("customer"+i);


for (int i=0; i<100;i++)


ar11.add("enginers"+i);



// Declare HeapJava7 memory management Dts 

HeapJ7 h <NEW> HeapJ7("");


  <OJ7UTIL>.ArrayList  ars = J7mem.J7Splitmem(ar);


 <OJ7UTIL>.ArrayList  ars1 = J7mem.J7Splitmem(ar11);


// Add  two arraylist object to heapJava7 MM dts

h.add(ars);

h.add(ars1);


// This ConverttoArrayList method is  used to convert string to arraylist.


  <OJ7UTIL>.ArrayList   ars11 = J7mem.ConverttoArrayList(h.getValue());


<PRINTLN>("welcome="+ars11);






      }

   }

}




Note: Use J7mem.dll  in Java7Properties file



Output

======

It will list 10 Lakh customer data and

100 engineers data.


==============================================================================================

                                             Sample -25 : OakJava7 Autoboxing  and its Advantages

==============================================================================================

Why  this   AutoBoxing  concept is focused  in  OakJava7 Version 1?

What  are  the  different types of  OakJava7  Util packages ? 


There are 3 kinds of OakJava7  Util packages

which are given below..

  i)  <OJ7UTIL>, <OAKJAVA7>

  ii) CUTIL,OJ7UTIL


So for converting from  <OJ7UTIL> to OJ7UTIL oakjava7 util packages

results in Autoboxing concept. Because these

two oakjava7 util packages  are of different types.But in

OakJava7 next version (OakJava7 version 2) , i will combine this

to a one  Oakjava7 util package. This is the demerits  of OakJava7 version 1.    

<OAKJAVA7> is just  the library package  for  OakJava7 Programming  package .


What is  Autoboxing in oakJava7 , Advantages and it's types ?

(important for Oakjava7 Streams) 

OakJava7 AutoBoxing is  a new concept like converting  OJ7UTIL type to

<OJ7UTIL> type. Like converting int to Integer format.

Today many developers will take some time and write a

logic for converting a  type to another type. That is

not a good way. That's why JIT(JeminInformationTechnology) invent a

new concept known as  AutoBoxing, that can be used in oakJava7 Streams

and at any oakjava7 logic.

Oakjava7 AutoBoxing Types are given below with Explanation....


1) Ist Type: Converting OJ7UTIL.ArrayList to <OJ7UTIL> ArrayList format.


<AUTOBOX>(OJ7UTIL.ArrayList val)

=> This oakjava7 api statement  will convert OJ7UTIL.ArrayList to <OJ7UTIL> ArrayList format.

That can be used in Streams etc.

example) This array List fixed size is  2 items ie) ArrayList index 0 and ArrayList index 1.That can be represented as OJ7UTIL.ArrayList(1).

  OJ7UTIL.ArrayList item = new OJ7UTIL.ArrayList(1);

           item.add(0,"California") ;   item.add(1,"Washington");

<OJ7UTIL>.ArrayList items1 =AutoBox.AutoBoxValue.callList(item);

so when we  print this items1 will print the two values 

which are  California and Washington states.


2) 2nd Type: Converting <OJ7UTIL>.ArrayList to  OJ7UTIL ArrayList format.

<AUTOBOX_J7ARRAY>(<OJ7UTIL>.ArrayList val)

=>  This oakjava7 api statement will convert <OJ7UTIL>.ArrayList to OJ7UTIL ArrayList format.

That can be used in Streams etc.

 example)

string w1="-1,-1";

<OJ7UTIL>.ArrayList  soap3=AutoBox.AutoBoxValue.callListJ7Array(w1);

OJ7UTIL.ArrayList arsd= <AUTOBOX_J7ARRAY>(soap3);

<PRINTLN> ("Print OJ7UTIL contents");

obj->J7Print(arsd);

<PRINTLN>(" ");


Output:

Print OJ7UTIL contents

[-1, -1]


3) 3rd Type: Converting Object[] obj (Object Array) to <OJ7UTIL> ArrayList format.

<AUTOBOX_OBJ_ARRAY>( Object[] obj )

=>  This oakjava7 api statement  will convert Object[] obj (Object Array) to <OJ7UTIL> ArrayList format. 

That can be used in Streams,etc.

eg) Here ans4,ans3,ans1 are the ArrayList objects and the result output will be the combined list of arraylist objects data to single list.

Object [] input={ ans4,ans3,ans1 };

<OJ7UTIL>.List list7 =<AUTOBOX_OBJ_ARRAY>(input);


4) Converting Object obj (Object ) to <OJ7UTIL> ArrayList format.

<AUTOBOX_ARRAY>( Object list )

=>  This oakjava7 api statement  will convert Object obj (Object / String) to <OJ7UTIL> ArrayList format.

That can be used in Streams,etc.

Example) This given below Oakjava7 statement will convert a  string to ArrayList format data.

string datan="SanJose,Dallas,Chicago,SanAntonio,LosAngeles,Portland,Tucson";

 <OJ7UTIL>.ArrayList  list=<AUTOBOX_ARRAY>(datan);


Output

[SanJose,Dallas,Chicago,SanAntonio,LosAngeles,Portland,Tucson]

Note: You must use AutoBoxValue.web.dll in oakJava7 properties.txt file

Note: This  new concept is  not allowed  to be  used  in other  programming Languages

and  this new concept  will be  belong  only  in OakJava7  Programming Language which is

invented  in  OakJava7   by  Wilmix Jemin j (jemin Information Technology). Because  this advantages are only  belong to  OakJava7.  For  OakJava7 ,,  C#  , C++ Developers purpose  we  include in this  tutorial.

==============================================================================================


      SAMPLE 26: Oakjava7 Signatures for Companies Use and Developer  use for a Oakjava7 Programs.


==============================================================================================


Q) Write a Oakjava7(JAVA7.0) program for OakJava7 Signatures for Companies Use and Developer Use for a Oakjava7 Programs.



oj7streamexample1.web



<WEB>


// OakJava7 Reflection method to protect the Oakjava7 Software..


<USE> <J7Reflection>

// Mention your company name... 

[<J7Assembly>CompanyAttribute("JeminInformationTechnology(JIT)")]

// Mention Configuration Attribute type as Debug

[<J7Assembly>ConfigurationAttribute("Debug")]

// Mention the FileVersion Attribute.. 

[<J7Assembly>FileVersionAttribute("1.0.0.0")]

//Mention the InformationalVersionAttribute

[<J7Assembly>InformationalVersionAttribute("1.0.0")]

// Mention the Product name

[<J7Assembly>ProductAttribute("Sumofdigits")]

// Mention the Title name

[<J7Assembly>TitleAttribute("Sumofdigits for the Given number")]

// Mention the Product version 

[<J7Assembly>VersionAttribute("1.0.0.0")]

// Mention your company copy right with year

[<J7Assembly>CopyrightAttribute("JeminInformationTechnology (c) 2023")]



<PACK> sample1

{



public <CLASS> Programn

{

 

  public void main()

    {


// Write any  OakJava7 Logic






       

    }

}

}


Output

============================================================================================================================================


Note:

Kindly  see  this web application example that are  the  basics  and  we  will  see JAVA7.0 MachineLearning ,JAVA7.0  with JDollarPart2, IMFFramework,Java7.0  with Dotweb3.0.  OakJava7  Programming  language  is not   released now .  when the  OakJava7 documentation is finished  we  will   release it.  But now don't  study the samples about Jdollarshell, since  many  of  programs methods is  to be changed. But you  can  go thru  Oakjava7  Samples right now.. Thanks  for  learning this tutorial. Here  JDollar(JWEB) ,JDollarShell, Chdollar(CH$) is not  released  and so   this  three   programming languages  are  not   included   in this   Tutorial.