PROG24178 Study Guide - Final Guide: Netbeans, Code Segment, Static Variable

247 views2 pages

Document Summary

*refer to the following class for the next few questions. * this is the main class. public class first { //define field variables public double digit=1. 0;//assign digit to 1. 0 public static double num=2. 0;//assign num to 2. 0, it is a static variable. * to change this license header, choose license headers in project properties. * to change this template file, choose tools | templates. * and open the template in the editor. package java_exam_review; * on run i got nothing, because we have not assigned the value of object one, just object two. Also remember that num is static and cannot be accessed outside of first class. public class third { //this is the run class public static void main(string[] args){ // first one=new first();//created a new object one from first class with a default constructor. // first two=new first();//create a second object two.

Get access

Grade+20% off
$8 USD/m$10 USD/m
Billed $96 USD annually
Grade+
Homework Help
Study Guides
Textbook Solutions
Class Notes
Textbook Notes
Booster Class
40 Verified Answers

Related Documents

Related Questions