Find the error in the following code. class Point { } public class Line!

CMPTR
3rd Edition
ISBN:9781337681872
Author:PINARD
Publisher:PINARD
Chapter1: Introduction To Computers And The Internet
Section: Chapter Questions
Problem 15QY
icon
Related questions
Question
Private access is sometimes called information
Transcribed Image Text:Private access is sometimes called information
Find the error in the following code.
class Point {
}
public class Line {
public int Line(Point p1, Point p2) {
}
private Point p1;
private Point p2;
You can't have a method with the same name as the class name.
O Line() can't accept parameters.
Line() can't return a value.
You can't have nested classes.
Transcribed Image Text:Find the error in the following code. class Point { } public class Line { public int Line(Point p1, Point p2) { } private Point p1; private Point p2; You can't have a method with the same name as the class name. O Line() can't accept parameters. Line() can't return a value. You can't have nested classes.
Expert Solution
steps

Step by step

Solved in 4 steps

Blurred answer
Knowledge Booster
Reference Types in Function
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
CMPTR
CMPTR
Computer Science
ISBN:
9781337681872
Author:
PINARD
Publisher:
Cengage
Enhanced Discovering Computers 2017 (Shelly Cashm…
Enhanced Discovering Computers 2017 (Shelly Cashm…
Computer Science
ISBN:
9781305657458
Author:
Misty E. Vermaat, Susan L. Sebok, Steven M. Freund, Mark Frydenberg, Jennifer T. Campbell
Publisher:
Cengage Learning