개발기록
Illegal start of type 본문
Rand.java:77: illegal start of type
return result ;
^
return문이 대괄호 밖에 있을때 발생하는 오류
필자는 타이핑 오류로 아래와 같이 괄호 오타가 발생하여 생겼다.
/**
* Definition for singly-linked list.
* public class ListNode {
* int val;
* ListNode next;
* ListNode(int x) { val = x; }
* }
*/
class Solution {
public ListNode addTwoNumbers(ListNode l1, ListNode l2) {}
int tmp = 0;
int tmp_rst = 0;
while((l1 != null) && (l2 != null)){
tmp_rst = 0;
tmp_rst = l1.val + l2.val + tmp;
tmp = tmp_rst / 10;
ListNode result = new ListNode(tmp_rst % 10);
result.next = new ListNode();
l1 = l1.next;
l2 = l2.next;
}
return result;
}
}