Advertisement
airton-junior

Temp Converter Class com Construtor

Apr 20th, 2023
720
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.60 KB | None | 0 0
  1. public with sharing class TempConverterWithConstructor {
  2.     private Decimal celsius;
  3.    
  4.     public TempConverterWithConstructor(){
  5.         System.debug('Olá Mundo');
  6.     }
  7.    
  8.     public TempConverterWithConstructor(String msg){
  9.         System.debug(msg);
  10.     }
  11.    
  12.     public TempConverterWithConstructor(Decimal temp){
  13.         this.celsius = temp;
  14.     }
  15.    
  16.    
  17.     public Decimal converteTemp(){
  18.         return this.celsius*1.8 + 32;
  19.     }
  20.    
  21. }
  22.  
  23. //ANONYMOUS
  24. /*
  25.  * TempConverterWithConstructor tcwc = new TempConverterWithConstructor(22);
  26.  
  27. System.debug(tcwc.converteTemp());
  28. */
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement