How can you debug the Java code?

Answers were Sorted based on User's Feedback



How can you debug the Java code?..

Answer / kishore kumar

All the above answers are not a valid answers for interview
purpose.
In the interview, you have to say:
we can debug the java code by using the log files.

Is This Answer Correct ?    11 Yes 4 No

How can you debug the Java code?..

Answer / shrads

By using F5 if we are working with java devlopment
environment.

Is This Answer Correct ?    4 Yes 1 No

How can you debug the Java code?..

Answer / kiran

jdb [ options ] [ class ] [ arguments ]

options
Command-line options, as specified below.
class
Name of the class to begin debugging.
arguments
Arguments passed to the main() method of class.

Is This Answer Correct ?    5 Yes 4 No

How can you debug the Java code?..

Answer / raghavendra

first you write a program in note pad.
after you save the program in "program name.jave"
after you check the java path and save the program correct
location after you start the compliation
compilation method:
javac program name.java
if any errors are generated again check the program and
remove the bugs
finally
java program name

Is This Answer Correct ?    3 Yes 2 No

How can you debug the Java code?..

Answer / gyana

If you want to debug java code, first you have to know at
what platform you use to write the java codes.

If you are using Textpad for writing java code ,then you
have to first save this file as "filename.java".Where the
file name should be same as the class which contain the
main method .Then go to command promot and type javac
filename.java to compile the programme.then if there is no
error then type java filename.In other way you just press
ctrl+1 to compile and ctrl+2 to debug.

Then if you are working on the netbeen
(Java software) then you have to only press F5 to debug the
project.

Is This Answer Correct ?    1 Yes 3 No

How can you debug the Java code?..

Answer / ravikiran(aptech mumbai)

by calling javac

Is This Answer Correct ?    1 Yes 7 No

Post New Answer

More Core Java Interview Questions

What are the 4 types of characters?

0 Answers  


Have you ever used hashtable and dictionary?

0 Answers  


Difference between this() and super() ?

0 Answers  


Difference between Preemptive scheduling vs. Time slicing?

0 Answers  


While opening the file, what type of exceptions can be caught?

3 Answers  






How is garbage collection controlled?

0 Answers  


What is static block?

0 Answers  


What is the static field modifier?

0 Answers  


how to pass the parameters to applets?

1 Answers  


What is mean by exception?

0 Answers  


why we import both packages java.awt.*; and java.awt.event.*; as java.awt.*; can import all classes na. then what is the need of importing java.awt.event.*; ?

3 Answers  


Question 7 [8] Consider the following class and answer the questions below it: public class StackWithGuard extends Stack { public StackWithGuard(int size) { super(size); } synchronized public boolean isEmpty() { return super.isEmpty(); } synchronized public boolean isFull() { return super.isFull(); } synchronized public int getSize() { return super.getSize(); } synchronized public void push(Object obj) { try { while (isFull()) { wait(); } } catch (InterruptedException e) {} super.push(obj); COS2144/102 11 notify(); } synchronized public Object pop() { try { while (isEmpty()) { wait(); } } catch (InterruptedException e) {} Object result = super.pop(); notify(); return result; } public static void main(String args[]) { StackWithGuard stack = new StackWithGuard(5); new Producer(stack, 15).start(); new Consumer(stack, 15).start(); } } Note: The Stack class is provided in the Appendix. Note also: The following questions all refer to the pop() method of the StackWithGuard class given above. 7.1 What does the synchronized keyword ensure for this method? (2) 7.2 Why is a while loop used to test whether the stack is empty? In other words, why wouldn't the following if statement be sufficient? if (isEmpty()) { wait(); } (2) 7.3 Why is the result of popping (provided by the inherited pop() method) stored in a temporary variable? In other words, why wouldn't the following statement be sufficient? return super.pop(); (2) 7.4 Why is the while loop placed in a try-catch structure? (2) Appendix The LinkedQueue class: public class LinkedQueue implements Queue { private Node first, last; private int count; public LinkedQueue() { first = last = null; count =0; } public int size() { return count; } public boolean isEmpty() { return (count == 0); 12 } public void enqueue(Object o) { Node node = new Node(); node.element = o; node.next = null; node.prev = last; if (last != null){ last.next = node; } else { last = first = node; } last = node; count++; } public void dequeue() { if ((first!= null) & (first.next!=null)) { first = first.next; first.prev = null; count--; } else { first = last = null; count--; } } public Object front() { return first; } } class Node { Object element; Node next, prev; } The Stack class: public class Stack { protected Object rep[]; protected int top = -1; protected int size = 0; protected int count = 0; public Stack(int size) { if (size > 0) { this.size = size; rep = new Object[size]; } } public boolean isFull() { return (count == size); } public boolean isEmpty() { return (count == 0); } public int getSize() { return size; } public void push(Object e) { if (e != null && !isFull()) { COS2144/102 13 top++; rep[top] = e; count ++; } } public Object pop() { Object result = null; if (!isEmpty()) { result = rep[top]; top--; count--; } return result; } }

0 Answers  


Categories