This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Gun | |
class ChamberError < StandardError; end | |
attr_reader :chamber | |
def initialize | |
@chamber = [] | |
end | |
def set_cartridge | |
raise ChamberError, 'The chamber is full' unless @chamber.empty? |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class Main { | |
public static void main (String[] args) { | |
System.out.print("Escribi algo: "); | |
BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); | |
String teclado = null; | |
try { | |
teclado = br.readLine(); | |
} catch (IOException ioe) { | |
System.out.println("IO error"); |