Mini Java compiler (VI)

Source: Internet
Author: User
Tags inheritance
Compile VII, System work process and operation instructions







































Eight, the instance program runs the result example one code
Class

main{

public static void Main (string[] args) {

SYSTEM.OUT.PRINTLN (10);

}

}

























Class g{

public int get (int num) {

int A;

a=2;

return a+5;

}

}

























Class H extends g{

int i;

Boolean Bol;

























public int put () {

i=1+2;

i=12-3;

i=2*7;

























Bol=true && false;

bol=1<2;

























return 10;

}

}
























Inheritance tree



























Symbol table



























Memory Allocation table



























Example two code
class Factorial {

public static void Main (string[] a) {

System.out.println (New Fac (). COMPUTEFAC (10));

}

}

























Class Fac extends factorial{

Fac F;

Factorial ff;

int i;

























public int computefac (int num) {

int Numaux;

if (num < 1)

Numaux = 1;

Else

Numaux = num * (THIS.COMPUTEFAC (num-1));

return numaux;

}

}

























Class F extends fac{

}

























Class G extends factorial{

}

























Class h{}

























Class I extends h{}

























Class J extends i{}

























Class GG extends i{}

























Class DD extends i{}
























Inheritance tree



























Symbol table



























Memory Allocation table





Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.