0

Error "cannot convert string to stringbuffer" . How do I modify this code

import java.util.Scanner; class MyClass { public static void main(String[ ] args) { Scanner myVar = new Scanner(System.in); StringBuffer n = new StringBuffer(); n=myVar.nextLine(); System.out.println(n); } }

5th Apr 2017, 3:07 AM
Harin Rajan K.R
Harin Rajan K.R - avatar
2 ответов
+ 6
StringBuffer n=new StringBuffer(myVar.nexrLine());
5th Apr 2017, 5:26 AM
Meharban Singh
Meharban Singh - avatar
+ 2
why not just switch stringbuffer to string
5th Apr 2017, 3:10 AM
Edward