Answered step by step
Verified Expert Solution
Question
00
1 Approved Answer
Can you run this Java program either in Visual Studio or Netbeans or Eclips and make a screenshot of the invalid output? please attach a
Can you run this Java program either in Visual Studio or Netbeans or Eclips and make a screenshot of the invalid output? please attach a short paragraph of description of why we test the invalid situation of it and how come to the invalid output.
For example, this is the valid input:
Here is the code: import java.util.*; // thread class class X extends Thread{ public void run() { JavaApplication1.arr[0]=0; JavaApplication1.arr[1]=1; // loop til; n times for(int i=2;i JavaApplication1.arr[i]=JavaApplication1.arr[i-1]+JavaApplication1.arr[i- 2];} } } // driver class public class JavaApplication1 { // declare a variable n static int n; // a variable of size 100 static int arr[]=new int[100]; public static void main(String args[]) { // fibonacci sequence System.out.println("enter the number of fibbonacci series length :"); // take the input Scanner sc=new Scanner(System.in); String str=sc.nextLine(); // take n as the input n=Integer.parseInt(str); // declare a thread X thread1=new X(); // start the thread thread1.start(); // run the thread try{ thread1.join(); } catch(Exception e) { } // print the fibonacci numbers System.out.println("the fibbonacci series numbers are"); for(int i=0;i System.out.println(arr[i]); } } public class test5 f static int n static int arri-new intr100 ublic statie void main (String args[) System.out.println ("enter the number of fibbonacci series length " Scanner sc=new scanner (System.in); String str-sc.nextLine n=Integer.parseln t (str) ; Problems @Javadoc Declaration Console 1 sterminated> test5 (Java Application] CProgram FilesUavaljre81bin javaw.exe (Sep 29, 2013 3:58:09 PM) enter the number of fibbonacci series length 7 the fibbonacci series numbers are: 1 2
Can you run this Java program either in Visual Studio or Netbeans or Eclips and make a screenshot of the invalid output? please attach a short paragraph of description of why we test the invalid situation of it and how come to the invalid output.
For example, this is the valid input:
Here is the code:
import java.util.*;
// thread class
class X extends Thread{
public void run()
{ JavaApplication1.arr[0]=0;
JavaApplication1.arr[1]=1;
// loop til; n times
for(int i=2;i JavaApplication1.arr[i]=JavaApplication1.arr[i-1]+JavaApplication1.arr[i- 2];}
}
}
// driver class
public class JavaApplication1 {
// declare a variable n
static int n;
// a variable of size 100
static int arr[]=new int[100];
public static void main(String args[])
{
// fibonacci sequence
System.out.println("enter the number of fibbonacci series length :");
// take the input
Scanner sc=new Scanner(System.in);
String str=sc.nextLine();
// take n as the input
n=Integer.parseInt(str);
// declare a thread
X thread1=new X();
// start the thread
thread1.start();
// run the thread
try{
thread1.join();
}
catch(Exception e)
{
}
// print the fibonacci numbers
System.out.println("the fibbonacci series numbers are");
for(int i=0;i System.out.println(arr[i]);
}
}
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access with AI-Powered Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started