Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Exception in thread "main" java.lang.Error: Unresolved compilation problems:
- Cannot instantiate the type Calculator2Service
- The method getCalculator2Port() is undefined for the type Calculator2Service
- at com.theopentutorials.ws.calc2.client.Calc2Client.main(Calc2Client.java:13)
- package com.theopentutorials.ws.calc2.client;
- import com.theopentutorials.ws.calc2.*;
- public class Calc2Client {
- /**
- * @param args
- */
- public static void main(String[] args) {
- int a = 10;
- int b = 12;
- Calculator2Service calcService = new Calculator2Service();
- Calculator2 calc = calcService.getCalculator2Port();
- System.out.println(a + " + " + b + " = " + calc.add(a, b));
- System.out.println(a + " - " + b + " = " + calc.sub(a, b));
- }
- }
- public interface Calculator2 {
- public double add(double a, double b);
- public double sub(double a, double b);
- }
- Calculator2 getCalculator2Port(){
- Calculator2 c = new Calculator2(){
- public double add(double a,double b){
- return(a+b);
- }
- public double sub (double a, double b){
- return(a-b);
- }
- }
- return(c);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement