public static void main(String[] args) { Scanner sc = new Scanner(System.in); String title = sc.nextLine(); MyBook new_novel = new MyBook(); new_novel.setTitle(title); System.out.println("The title is: " + new_novel.getTitle()); }
public static void main(String[] args) { // Book new_novel=new Book(); This line prHMain.java:25: error: Book is abstract; cannot be // instantiated Scanner sc = new Scanner(System.in); String title = sc.nextLine(); MyBook new_novel = new MyBook(); new_novel.setTitle(title); System.out.println("The title is: " + new_novel.getTitle()); }
public void testMarshalNoEncoding() throws Exception { // NOTE: We are using a processor to do the assertions as the mock endpoint (Camel) does not yet // support // type conversion using byte and strings where you can set a charset encoding final String title = "Hello World"; context.addRoutes( new RouteBuilder() { public void configure() { from("direct:start").marshal().string().process(new MyBookProcessor(null, title)); } }); context.start(); MyBook book = new MyBook(); book.setTitle(title); template.sendBody("direct:start", book); }
public void testMarshalUTF8() throws Exception { // NOTE: We are using a processor to do the assertions as the mock endpoint (Camel) does not yet // support // type conversion using byte and strings where you can set a charset encoding // include a UTF-8 char in the text \u0E08 is a Thai elephant final String title = "Hello Thai Elephant \u0E08"; context.addRoutes( new RouteBuilder() { public void configure() { from("direct:start") .marshal() .string("UTF-8") .process(new MyBookProcessor("UTF-8", title)); } }); context.start(); MyBook book = new MyBook(); book.setTitle(title); template.sendBody("direct:start", book); }