A block is in a sense just an anymonous function. I have never programmed java, but here are some code samples for other languages to show you that blocks are similar to passing anonymous functions.
Ruby:
def add_5
puts yield + 5
end
add_5 { 20 }
# => 25
Javascript:
var add_5 = function(callback){
return callback.call() + 5;
}
add_5(function(){ return 20 });
// returns 25
Lua:
local function add_5(callback)
print(callback() + 5);
end
add_5(function()
return 20;
end)
-- returns 25
In other words, if Java supports anonymous functions like that, you got yourself a block! As they're functions, they can take arguments, just like blocks. Here's another Lua example:
local function add_something(callback)
callback(5 / 2);
end
add_something(function(a)
print(a + 5);
end)
-- 7.5