MIS 260 Practice - week 6
1. Analyze below program and then answer for questions.
public class Practice1
{
public static void main ( String[] args )
{
String str;
int value;
str = new String( "MIS" );
value = 77;
System.out.println( str );
System.out.println( value );
}
}
· How many objects were created?
· What is/are (an) object(s) variable name?
· What are the differences between str variable and value variable?
· What are the outcome of this program?
2. Analyze below program and then answer for questions.
public class Practice2
{
public static void main ( String[] args )
{
String str;
str = new String("MIS");
System.out.println(str);
str = new String("Java class");
System.out.println(str);
}
}
· How many objects were created?
· What is/are (an) object(s) variable name?
· What are the differences between first str variable and second str variable?
· What are the outcome of this program?
3. Apply concept of external input data (chap 10, 21, and 22) to practice 3 programs.
Java Assignment 5: (Turn in by email – attach the program)
Due: will be announced by instructor
Score: 10 points
Modify and complete the assignment #3 (Siblings.java) program using the oncept of external input data (chap 10, 21, and 22)
Analyze below program and then answer for questions.
public class Prctice3
{
public static void main ( String[] args )
{
String strA;
String strB;
strA = new String( "MIS" );
strB = new String( "Java" );
System.out.println( strB );
System.out.println( strA );
if ( strA == strB )
System.out.println( "This will NOT print.");
}
}
How many objects were created?
What is/are (an) object(s) variable name?
What are the differences between strA variable and strB variable?
What are the outcomes of this program?